Flutter Geolocator Plugin

pub package

A Flutter geolocation plugin which provides easy access to the platform specific location services (FusedLocationProviderClient or if not available the LocationManager on Android and CLLocationManager on iOS).

BranchBuild Status
developBuild Status
masterBuild Status


  • Get the current location of the device;
  • Get the last known location;
  • Get continuous location updates;
  • Check if location services are enabled on the device;
  • Translate an address to geocoordinates and vice verse (a.k.a. Geocoding);
  • Calculate the distance (in meters) between two geocoordinates;
  • Check the availability of Google Play services (on Android only).


To use this plugin, add geolocator as a dependency in your pubspec.yaml file. For example:

  geolocator: '^2.1.0'

NOTE: There's a known issue with integrating plugins that use Swift into a Flutter project created with the Objective-C template. See issue Flutter#16049 for help on integration.



To query the current location of the device simply make a call to the getCurrentPosition method:

import 'package:geolocator/geolocator.dart';

Position position = await Geolocator().getCurrentPosition(desiredAccuracy: LocationAccuracy.high);

To query the last known location retrieved stored on the device you can use the getLastKnownPosition method (note that this can result in a null value when no location details are available):

import 'package:geolocator/geolocator.dart';

Position position = await Geolocator().getLastKnownPosition(desiredAccuracy: LocationAccuracy.high);

To listen for location changes you can subscribe to the onPositionChanged stream. Supply an instance of the LocationOptions class to configure the desired accuracy and the minimum distance change (in meters) before updates are send to the application.

import 'package:geolocator/geolocator.dart';

var geolocator = Geolocator();
var locationOptions = LocationOptions(accuracy: LocationAccuracy.high, distanceFilter: 10);

StreamSubscription<Position> positionStream = geolocator.getPositionStream(locationOptions).listen(
    (Position position) {
        print(_position == null ? 'Unknown' : _position.latitude.toString() + ', ' + _position.longitude.toString());

To check if location services are enabled you can call the checkGeolocationPermissionStatus method. This method returns a value of the GeolocationStatus enum indicating the availability of the location services on the device. Optionally you can specify if you want to test for GeolocationPermission.locationAlways or GeolocationPermission.locationWhenInUse (by default GeolocationPermission.location is used, which checks for either one of the previously mentioned permissions). Example usage:

import 'package:geolocator/geolocator.dart';

GeolocationStatus geolocationStatus  = await Geolocator().checkGeolocationPermissionStatus();

By default Geolocator will use FusedLocationProviderClient on Android when Google Play Services are available. It will fall back to LocationManager when it is not available. You can override the behaviour by setting forceAndroidLocationManager.

import 'package:geolocator/geolocator.dart';

Geolocator geolocator = Geolocator()..forceAndroidLocationManager = true;
GeolocationStatus geolocationStatus  = await geolocator.checkGeolocationPermissionStatus();


To translate an address into latitude and longitude coordinates you can use the placemarkFromAddress method:

import 'package:geolocator/geolocator.dart';

List<Placemark> placemark = await Geolocator().placemarkFromAddress("Gronausestraat 710, Enschede");

If you want to translate latitude and longitude coordinates into an address you can use the placemarkFromCoordinates method:

import 'package:geolocator/geolocator.dart';

List<Placemark> placemark = await Geolocator().placemarkFromCoordinates(52.2165157, 6.9437819);

Both the placemarkFromAddress and placemarkFromCoordinates accept an optional localeIdentifier parameter. This paramter can be used to enforce the resulting placemark to be formatted (and translated) according to the specified locale. The localeIdentifier should be formatted using the syntax: languageCode_countryCode. Use the ISO 639-1 or ISO 639-2 standard for the language code and the 2 letter ISO 3166-1 standard for the country code. Some examples are:

Locale identifierDescription
enAll English speakers (will translate all attributes to English)
en_USEnglish speakers in the United States of America
en_UKEnglish speakers in the United Kingdom
nl_NLDutch speakers in The Netherlands
nl_BEDutch speakers in Belgium

Calculate distance

To calculate the distance (in meters) between two geocoordinates you can use the distanceBetween method. The distanceBetween method takes four parameters:

startLatitudedoubleLatitude of the start position
startLongitudedoubleLongitude of the start position
endLatitudedoubleLatitude of the destination position
endLongitudedoubleLongitude of the destination position
import 'package:geolocator/geolocator.dart';

double distanceInMeters = await Geolocator().distanceBetween(52.2165157, 6.9437819, 52.3546274, 4.8285838);

See also the example project for a complete implementation.



On Android you'll need to add either the ACCESS_COARSE_LOCATION or the ACCESS_FINE_LOCATION permission to your Android Manifest. Todo so open the AndroidManifest.xml file and one of the following two lines as direct children of the <manifest> tag:

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

NOTE: Specifying the ACCESS_COARSE_LOCATION permission results in location updates with an accuracy approximately equivalant to a city block. More information can be found here.


On iOS you'll need to add the NSLocationWhenInUseUsageDescription to your Info.plist file in order to access the device's location. Simply open your Info.plist file and add the following:

<string>This app needs access to location when open.</string>

If you would like to access the device's location when your App is running in the background, you should also add the NSLocationAlwaysAndWhenInUseUsageDescription (if your App support iOS 10 or earlier you should also add the key NSLocationAlwaysUsageDescription) key to your Info.plist file:

<string>This app needs access to location when in the background.</string>
<string>This app needs access to location when open and in the background.</string>

Location accuracy

The table below outlines the accuracy options per platform:

medium100 - 500m100m
high0 - 100m10m
best0 - 100m~0m
bestForNavigation0 - 100mOptimized for navigation


Please file any issues, bugs or feature request as an issue on our GitHub page.

Want to contribute

If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug or adding a cool new feature), please carefully review our contribution guide and send us your pull request.


This Geolocator plugin for Flutter is developed by Baseflow. You can contact us at hello@baseflow.com