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 location plugin.

Constructors

LocationManager()
Get the singleton LocationManager instance
factory

Properties

configuration LocationService?
no setter
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
lastKnownLocation Location?
The last know location, if any.
no setter
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>
getLocation() Future<Location>
Gets the current location of the phone. In case the location cannot be obtained within a few seconds, the last known location is returned.
hasPermission() Future<bool>
Does this location manger have permission to access location?
isBackgroundModeEnabled() Future<bool>
Is the location service enabled in background mode?
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.
override

Operators

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