location property

Location? location
getter/setter pair

Last known position of the device.

Note: BackgroundGeolocation does not actively request the current position during each BackgroundGeolocation.onHeartbeat event. This is only the last known position.

If you wish for the current position, you can choose to request in your BackgroundGeolocation.onHeartbeat callback.

Example

BackgroundGeolocation.onHeartbeat((HeartbeatEvent event) {
  Location location = BackgroundGeolocation.getCurrentPosition(
    samples: 1,
    extras: {
      "foo": "bar"
    }
  );
});

Implementation

Location? location;