location 2.0.0

  • README.md
  • Example
  • Installing
  • Versions
  • 96

Flutter Location Plugin pub package

This plugin for Flutter handles getting location on Android and iOS. It also provides callbacks when location is changed.

Demo App

Breaking Changes #

As of the 1.4 version, you have to call getLocation() instead of just getLocation and onLocationChanged() instead of onLocationChanged.

Getting Started #

In order to use this plugin in Android, you have to add this permission in AndroidManifest.xml :

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

Permission check for Android 6+ was added. Still no callback when permissions granted so aiming SDK 21 is safer.

And to use it in iOS, you have to add this permission in Info.plist :


Then you just have to import the package with

import 'package:location/location.dart';

Look into the example for utilisation, but a basic implementation can be done like this for a one time location :

var currentLocation = <String, double>{};

var location = new Location();

// Platform messages may fail, so we use a try/catch PlatformException.
try {
  currentLocation = await location.getLocation;
} on PlatformException {
  currentLocation = null;

You can also get continuous callbacks when your position is changing:

var location = new Location();

location.onLocationChanged().listen((Map<String,double> currentLocation) {
  print(currentLocation["speed_accuracy"]); // Will always be 0 on iOS


In this table you can find the different functions exposed by this plugin:

Future<Map<String, double>>getLocation() <br> Allow to get a one time position of the user.
FuturehasPermission() <br> Return a boolean to know the state of the location permission.
Stream<Map<String, double>>onLocationChanged() <br> Get the stream of the user's location.

Feedback #

Please feel free to give me any feedback helping support this plugin !

[2.0.0] 25th January 2019

  • Code cleanup
  • BREAKING CHANGE: Change Dart API to return structured data rather than a map.

[1.4.0] 21st August 2018

  • Add lazy permission request thanks to yathit
  • Add hasPermission() thanks to vagrantrobbie
  • Bug correction thanks to jalpedersen
  • Add more examples

[1.3.4] 4th June 2018

  • Fix crash for Android API pre 27 thanks to matthewtsmith.

[1.3.3] 30th May 2018

  • Correct implementation of iOS plugin to match Android behaviour. No need to call getLocation to get permissions for location callbacks.

[1.3.2] 30th May 2018

  • Change implementation to api in build.gradle in order to solve incompatibilities between GMS versions thanks to luccascorrea

[1.3.1] 29th May 2018

  • Added speed and speed_accuracy (only Android truly discover speed accuracy, so its always 0 for now on iOS)
  • Solved a crash

[1.3.0] 27th May 2018

  • Make it compatible with Firebase thanks to quangIO
  • Resolve runtime error exception thanks to jharrison902
  • Update gitignore thanks to bcko

[1.2.0] 5th April 2018

  • Permissions denied on Android handled thanks to g123k
  • Dart 2 update thanks to efortuna

[1.1.6] - 19th Octobre 2017.

  • iOS code from Swift to Objective-C thanks to fluff

[1.1.1] - 20th July 2017.

  • Fixes for iOS result's format.

[1.1.0] - 17th July 2017.

  • Added permission check for Android 6+ (thanks netdur). Still no callback when permissions granted so aiming SDK 21 is safer.

[1.0.0] - 7th July 2017.

  • Initial Release.


location_example #

Demonstrates how to use the location plugin.

Getting Started #

For help getting started with Flutter, view our online documentation.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  location: ^2.0.0

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:location/location.dart';
Version Uploaded Documentation Archive
2.0.0 Feb 7, 2019 Go to the documentation of location 2.0.0 Download location 2.0.0 archive
1.4.1 Aug 22, 2018 Go to the documentation of location 1.4.1 Download location 1.4.1 archive
1.4.0 Aug 21, 2018 Go to the documentation of location 1.4.0 Download location 1.4.0 archive
1.3.4 Jun 4, 2018 Go to the documentation of location 1.3.4 Download location 1.3.4 archive
1.3.3 May 30, 2018 Go to the documentation of location 1.3.3 Download location 1.3.3 archive
1.3.2 May 30, 2018 Go to the documentation of location 1.3.2 Download location 1.3.2 archive
1.3.1 May 29, 2018 Go to the documentation of location 1.3.1 Download location 1.3.1 archive
1.3.0 May 24, 2018 Go to the documentation of location 1.3.0 Download location 1.3.0 archive
1.2.0 Apr 5, 2018 Go to the documentation of location 1.2.0 Download location 1.2.0 archive
1.1.7 Nov 29, 2017 Go to the documentation of location 1.1.7 Download location 1.1.7 archive

All 20 versions...

Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Feb 14, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.13
  • Flutter: 1.2.0


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Maintenance suggestions

The package description is too short. (-15 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8