Location class

Location object provided to:

BackgroundGeolocation.onLocation((Location location) {
  double accuracy = location.coords.accuracy;
  double lat      = location.coords.latitude;
  double lng      = location.coords.longitude;
  double speed    = location.coords.speed;
  double heading  = location.coords.heading;
  double altitude = location.coords.altitude;

  print("[onLocation] $location");
});

BackgroundGeolocation.onMotionChange(Location location) {
  print("[onMotionChange] $location");
});

State state = await BackgroundGeolocation.ready(Config(
  distanceFilter: 10.0
));

Location location = await BackgroundGeolocation.getCurrentPosition();
print("[getCurrentPosition] location: $location");

Constructors

Location(dynamic params)

Properties

activity ↔ Activity
Device motion-activity when this Location was recorded.
getter/setter pair
age ↔ double
The age of the location in seconds, with millisecond precision: how long before the SDK received the location the native API had fixed it. For example, if the reported age is 10.0, that location was fixed 10s before the SDK received it. recordedAt is the time the SDK received it.
getter/setter pair
battery ↔ Battery
Device battery-level when this Location was recorded.
getter/setter pair
coords ↔ Coords
Location coordinates.
getter/setter pair
event ↔ String
Event which caused this location to be recorded.
getter/setter pair
extras ↔ Map?
Arbitrary extras object from configured PersistenceConfig.extras.
getter/setter pair
geofence ↔ GeofenceTrigger?
Corresponding GeofenceTrigger if this location was recorded due to a Geofence transition.
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
isMoving ↔ bool
true if this Location was recored while the device was in-motion.
getter/setter pair
map ↔ dynamic
Original Map data received from native code.
getter/setter pair
mock ↔ bool
[Android only] true if the location was provided by a Mock location app.
getter/setter pair
odometer ↔ double
The current distance traveled.
getter/setter pair
recordedAt ↔ dynamic
Timestamp when the SDK received the location from the native API.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sample ↔ bool
true if this Location is just 1 of several samples before settling upon a final location.
getter/setter pair
timestamp ↔ dynamic
Timestamp provided by the native location API.
getter/setter pair
uuid ↔ String
Universally Unique Identifier.
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toMap() → Map
Return original Map recevied from native code.
toString() → String
String representation of Location for print to logs.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited