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 int
The age of the location in milliseconds, relative to the Device system-time when the location was received. For example, if the reported age is 10000, that location was recorded 10s ago, relative to the system-time. location.timestamp + location.age = Device system-time when location was recorded.
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 Config.extras.
getter/setter pair
geofence GeofenceEvent?
Corresponding GeofenceEvent 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
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 String
Timestamp in __ISO 8601 (UTC) format.
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