large Flutter Favorite logosmall Flutter Favorite logo

geolocator 1.1.0 icon indicating copy to clipboard operation
geolocator: ^1.1.0 copied to clipboard

[pending analysis]

Geolocation plugin for Flutter. This plugin provides a cross-platform API for generic location (GPS etc.) functions.

Flutter Geolocator Plugin #

A Flutter plugin which provides easy access to the platform specific location services (LocationManager on Android and CLLocationManager on iOS).

BranchBuild Status
developBuild Status
masterBuild Status

Usage #

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

  geolocator: '^1.0.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.

Permissions #

Android #

On Android you'll need to add the ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATION permissions to your Android Manifest. Todo so open the AndroidManifest.xml file and add 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" />

iOS #

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>

Example #

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

import 'package:geolocator/geolocator.dart';
import 'package:geolocator/models/location_accuracy.dart';
import 'package:geolocator/models/position.dart';

Position position = await new Geolocator().getPosition(LocationAccuracy.High);

To listen for location changes you can subscribe to the onPositionChanged stream:

import 'package:geolocator/geolocator.dart';
import 'package:geolocator/models/location_accuracy.dart';
import 'package:geolocator/models/position.dart';

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

See also the example project for a complete implementation.

Location accuracy #

The table below outlines the accuracy options per platform:

Medium100 - 500m100m
High0 - 100m10m
Best0 - 100m~0m
pub points


verified publisher

Geolocation plugin for Flutter. This plugin provides a cross-platform API for generic location (GPS etc.) functions.

Repository (GitHub)
View/report issues


Icon for licenses.unknown (LICENSE)


flutter, meta


Packages that depend on geolocator