location_picker 0.0.16

  • Readme
  • Changelog
  • Example
  • Installing
  • 18

location_picker #

A location picker plugin for Flutter.

What it does #

As the name implies, this is a component for getting a desired location from the user. It handles location permissions requests, a native map view and it return a map with all the data. It also uses reversed GeoCoding for info associated with the selected location.

Example #

        LocationPicker.initApiKey('YOUR API KEY');
        LocationPicker picker = new LocationPicker();
          result = await picker.showLocationPicker;
          on PlatformException 
          //HANDLE ERROR
        setState(() {_locationPickerData = result.toString();});

Configuration #

The constructor

new LocationPicker();

Takes the following optional parameters for configuration:

      String titleText;
      bool closeIfLocationDenied;
      bool useGeoCoder;
      double initialLat;
      double initialLong;
      bool enableMyLocation;
      String androidAppBarColor;
      String androidNavBarColor;
      String androidStatusBarColor;
      String androidSelectButtonColor;
      String androidTitleAndBackButtonColor;
      //IOS ONLY
      String iosBackButtonText;
      String iosSelectButtonText;

Response #

The response is a Map<dynamic,dynamic> that contains the following fields that can be null:

                             ["latitude"] double
                             ["longitude"] double
                             ["administrativeArea"] String
                             ["country"] String
                             ["locality"] String
                             ["subLocality"] String
                             ["postalCode"] String
                             ["thoroughfare"] String
                             ["line0"] String
                             ["line1"] String

Importing #

  1. Create a Flutter project with Swift support.

  2. Import the library

Installing #

  1. Get your Google Maps Api Key.

Android #

  1. Request permissions in your manifest

     <uses-permission android:name="android.permission.INTERNET"/>
     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
  2. Add your Android API Key in your manifest inside the application tag

      android:value="YOUR API KEY"/>
  3. Add the map Activity to your app's manifest



  1. Request permissions in your project's info.plist

    <string>Your message to the user</string>

Getting Started #

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

For help on editing plugin code, view the documentation.

[0.0.1] - TODO: Add release date. #

  • TODO: Describe initial release.


import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:location_picker/location_picker.dart';

void main() => runApp(new MyApp());

class MyApp extends StatefulWidget {

  _MyAppState createState() => new _MyAppState();

class _MyAppState extends State<MyApp> {

  String _platformVersion = 'Unknown';
  String _locationPickerData = 'locationPicker';

  Map<dynamic, dynamic> result = new Map();
  initState() {

  // Platform messages are asynchronous, so we initialize in an async method.
  initPlatformState() async {
    LocationPicker.initApiKey('YOUR API KEY');
    LocationPicker picker = new LocationPicker();
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      result = await picker.showLocationPicker;
    } on PlatformException {
    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted)

    setState(() {
    _locationPickerData = result.toString();

  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: new Text('Plugin example app'),
        body: new Center(
          child: new Text(_locationPickerData),

Use this package as a library

1. Depend on it

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

  location_picker: ^0.0.16

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:

import 'package:location_picker/location_picker.dart';
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.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://dart.dev/dart-2#migration.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.9.0 <2.0.0