LocationManager class

A manger that knows how to get location information. Provide access to location data while the app is in the background.

Use as a singleton:

LocationManager()...

Note that this LocationManager tries to handle location permissions during its configuration (via the configure method) and the hasPermission and requestPermission methods.

However, it is much better - and also recommended by both Apple and Google - to handle permissions on an application level and show the location permission dialogue to the user before using probes that depend on location.

This LocationManager based on the geolocator plugin.

Constructors

LocationManager()
Get the singleton LocationManager instance
factory

Properties

configured bool
Is the location service configured via the configure method.
no setter
enabled bool
Is the location service enabled, which entails that
no setter
hashCode int
The hash code for this object.
no setterinherited
onLocationChanged Stream<Location>
Returns a stream of Location objects.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

configure(LocationService configuration) Future<void>
Configures the LocationManager, incl. sending a notification to the Android notification system.
enable() Future<void>
Enable the LocationManager, incl. sending a notification to the Android notification system.
getLocation() Future<Location>
Gets the current location of the phone.
hasPermission() Future<PermissionStatus>
Does this location manger have permission to access location "always"?
isGranted() Future<bool>
Has location been granted to this location manager?
lastKnownLocation() Future<Location?>
Gets the last known location of the phone.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
requestPermission() Future<PermissionStatus>
Request permissions to access location.
toString() String
A string representation of this object.
inherited

Operators

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