Geolocator class

Provides easy access to the platform specific location services (CLLocationManager on iOS and FusedLocationProviderClient on Android)

Constructors

Geolocator()
Constructs a singleton instance of Geolocator. [...]
factory
Geolocator.private(MethodChannel _methodChannel, EventChannel _eventChannel, LocationPermissions _permissionHandler)
This constructor is only used for testing and shouldn't be accessed by users of the plugin.

Properties

forceAndroidLocationManager bool
On Android devices you can set forceAndroidLocationManager to true to force the plugin to use the LocationManager to determine the position instead of the FusedLocationProviderClient. On iOS this is ignored.
read / write
hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

bearingBetween(double startLatitude, double startLongitude, double endLatitude, double endLongitude) Future<double>
Returns the initial bearing between two points The initial bearing will most of the time be different than the end bearing, see https://www.movable-type.co.uk/scripts/latlong.html#bearing
checkGeolocationPermissionStatus({GeolocationPermission locationPermission = GeolocationPermission.location}) Future<GeolocationStatus>
Returns a Future containing the current GeolocationStatus indicating the availability of location services on the device.
distanceBetween(double startLatitude, double startLongitude, double endLatitude, double endLongitude) Future<double>
Returns the distance between the supplied coordinates in meters.
getCurrentPosition({LocationAccuracy desiredAccuracy = LocationAccuracy.best, GeolocationPermission locationPermissionLevel = GeolocationPermission.location}) Future<Position>
Returns the current position taking the supplied desiredAccuracy into account. [...]
getLastKnownPosition({LocationAccuracy desiredAccuracy = LocationAccuracy.best, GeolocationPermission locationPermissionLevel = GeolocationPermission.location}) Future<Position>
Returns the last known position stored on the users device. [...]
getPositionStream([LocationOptions locationOptions = const LocationOptions(), GeolocationPermission locationPermissionLevel = GeolocationPermission.location]) Stream<Position>
Fires whenever the location changes outside the bounds of the desiredAccuracy. [...]
isLocationServiceEnabled() Future<bool>
Returns a Future containing a bool value indicating whether location services are enabled on the device.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
placemarkFromAddress(String address, {String localeIdentifier}) Future<List<Placemark>>
Returns a list of Placemark instances found for the supplied address. [...]
placemarkFromCoordinates(double latitude, double longitude, {String localeIdentifier}) Future<List<Placemark>>
Returns a list of Placemark instances found for the supplied coordinates. [...]
placemarkFromPosition(Position position, {String localeIdentifier}) Future<List<Placemark>>
Convenience method to access placemarkFromCoordinates() using an instance of Position. [...]
toString() String
A string representation of this object. [...]
inherited

Operators

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