Geolocator class
Wraps CLLocationManager (on iOS) and FusedLocationProviderClient or LocationManager (on Android), providing support to retrieve position information of the device.
Permissions are automatically handled when retrieving position information. However utility methods for manual permission management are also provided.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
bearingBetween(
double startLatitude, double startLongitude, double endLatitude, double endLongitude) → double - Calculates the initial bearing between two points
-
checkPermission(
) → Future< LocationPermission> - Returns a Future indicating if the user allows the App to access the device's location.
-
distanceBetween(
double startLatitude, double startLongitude, double endLatitude, double endLongitude) → double - Calculates the distance between the supplied coordinates in meters.
-
getCurrentPosition(
{LocationAccuracy desiredAccuracy = LocationAccuracy.best, bool forceAndroidLocationManager = false, Duration? timeLimit}) → Future< Position> -
Returns the current position taking the supplied
desiredAccuracy
into account. -
getLastKnownPosition(
{bool forceAndroidLocationManager = false}) → Future< Position?> - Returns the last known position stored on the users device.
-
getLocationAccuracy(
) → Future< LocationAccuracyStatus> - Returns a Future containing a LocationAccuracyStatus When the user has given permission for approximate location, LocationAccuracyStatus.reduced will be returned, if the user has given permission for precise location, LocationAccuracyStatus.precise will be returned
-
getPositionStream(
{LocationSettings? locationSettings}) → Stream< Position> - Fires whenever the location changes inside the bounds of the supplied LocationSettings.accuracy.
-
getServiceStatusStream(
) → Stream< ServiceStatus> - Fires whenever the location services are disabled/enabled in the notification bar or in the device settings. Returns ServiceStatus.enabled when location services are enabled and returns ServiceStatus.disabled when location services are disabled
-
isLocationServiceEnabled(
) → Future< bool> - Returns a Future containing a bool value indicating whether location services are enabled on the device.
-
openAppSettings(
) → Future< bool> - Opens the App settings page.
-
openLocationSettings(
) → Future< bool> - Opens the location settings page.
-
requestPermission(
) → Future< LocationPermission> - Request permission to access the location of the device.
-
requestTemporaryFullAccuracy(
{required String purposeKey}) → Future< LocationAccuracyStatus> - Requests temporary precise location when the user only gave permission for approximate location (iOS 14+ only)