Location class
Location object provided to:
- BackgroundGeolocation.onLocation
- BackgroundGeolocation.onMotionChange,
- BackgroundGeolocation.getCurrentPosition.
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
Locationwas 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
ageis10.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
Locationwas 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
-
trueif thisLocationwas recored while the device was in-motion.getter/setter pair - map ↔ dynamic
-
Original
Mapdata received from native code.getter/setter pair - mock ↔ bool
-
[Android only]trueif 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
-
trueif 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
Maprecevied from native code. -
toString(
) → String -
String representation of
Locationforprintto logs.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited