headers property

Map<String, dynamic>? headers
getter/setter pair

Optional HTTP headers applied to each HTTP request.

Example

BackgroundGeolocation.ready(Config(
  url: 'https://my.server.com',
  headers: {
    'authorization': "Bearer <a secret key>",
    'X-FOO": "BAR'
  }
));

Observing incoming requests at your server:

POST /locations
{
  "host": "tracker.transistorsoft.com",
  "content-type": "application/json",
  "content-length": "456"
  .
  .
  .
  "authorization": "Bearer <a secret key>",
  "X-FOO": "BAR"
}

Note: The plugin automatically applies a number of required headers, including "content-type": "application/json" See also: HTTP Guide at HttpEvent.

Implementation

Map<String, dynamic>? headers;