Skip to content

HttpEvent

class HttpEvent

HTTP response payload delivered to BackgroundGeolocation.onHttp.

The SDK fires this event after every upload attempt — whether the request succeeded or failed. Use it to inspect the server response, handle errors, or trigger follow-up logic in your app.

BackgroundGeolocation.onHttp((HttpEvent event) {
  if (event.success) {
    print('[onHttp] Upload succeeded: ${event.status}');
  } else {
    print('[onHttp] Upload failed: ${event.status} ${event.responseText}');
  }
});

Members

responseText

String responseText

Raw response body returned by the server.

Parse this string to extract server-side data, error messages, or remote-control commands embedded in the response.

status

int status

HTTP status code returned by the server (e.g. 200, 201, 404, 500).

success

bool success

true when the server returned a 2xx status code.