google_map_location_picker 1.0.5+2

google_map_location_picker Pub

Location picker using the official google_maps_flutter.

I made This plugin because google deprecated Place Picker.

Getting Started #

Get an API key at

Android #

Specify your API key in the application manifest android/app/src/main/AndroidManifest.xml:

<manifest ...
  <application ...
    <meta-data android:name=""
               android:value="YOUR KEY HERE"/>

iOS #

Specify your API key in the application delegate ios/Runner/AppDelegate.m:

#include "AppDelegate.h"
#include "GeneratedPluginRegistrant.h"
#import "GoogleMaps/GoogleMaps.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  [GMSServices provideAPIKey:@"YOUR KEY HERE"];
  [GeneratedPluginRegistrant registerWithRegistry:self];
  return [super application:application didFinishLaunchingWithOptions:launchOptions];

Or in your swift code, specify your API key in the application delegate ios/Runner/AppDelegate.swift:

import UIKit
import Flutter
import GoogleMaps

@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?
  ) -> Bool {
    GMSServices.provideAPIKey("YOUR KEY HERE")
    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)

Opt-in to the embedded views preview by adding a boolean property to the app's Info.plist file with the key io.flutter.embedded_views_preview and the value YES.

Using #

import 'package:google_map_location_picker/google_map_location_picker.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';

LatLng result = await LocationPicker.pickLocation(context);

Note #

The following permissions are not required to use Google Maps Android API v2, but are recommended.

android.permission.ACCESS_COARSE_LOCATION Allows the API to use WiFi or mobile cell data (or both) to determine the device's location. The API returns the location with an accuracy approximately equivalent to a city block.

android.permission.ACCESS_FINE_LOCATION Allows the API to determine as precise a location as possible from the available location providers, including the Global Positioning System (GPS) as well as WiFi and mobile cell data.

You must also explicitly declare that your app uses the or android.hardware.location.gps hardware features if your app targets Android 5.0 (API level 21) or higher and uses the ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission in order to receive location updates from the network or a GPS, respectively.

<uses-feature android:name="" android:required="false" />
<uses-feature android:name="android.hardware.location.gps" android:required="false"  />

The following permissions are defined in the package manifest, and are automatically merged into your app's manifest at build time. You don't need to add them explicitly to your manifest:

android.permission.INTERNET Used by the API to download map tiles from Google Maps servers.

android.permission.ACCESS_NETWORK_STATE Allows the API to check the connection status in order to determine whether data can be downloaded.

1.0.5+2 #

  • updated google_maps_flutter: ^0.5.20+2

1.0.5+1 #

  • updated google_maps_flutter: ^0.5.19+2

1.0.5 #

  • updated google_maps_flutter: ^0.5.19

1.0.4 #

  • remove ConstrainedBox around address card as the font changes sometimes cutouts happen.

1.0.3 #

  • remove some useless logging.

1.0.2 #

  • fix the address card mix height it and sometimes it's cutout.

1.0.1 #

  • remove unused code.

1.0.0 #

  • fix bug with requesting location permission
  • fix the address card mix height it and sometimes it's cutout.
  • added library and export only the important parts

0.2.0 #

  • now retuning the address plus LatLng
  • do the reverse geocoding with google web api instead of the native lib.

0.1.1 #

  • Updated min dart version to 2.2.2.
  • fix some formatting issues.

0.1.0 #

  • Added place search feature.

0.0.5 #

  • updated deps

0.0.4 #

  • remove permissions from package AndroidManifest.xml as it's already added by google maps.
  • improved README

0.0.2 #

  • added the permissions to the package directly.

0.0.1 #

  • initial release.


example/dio.dart #

import 'package:flutter/material.dart';
import 'package:google_map_location_picker/google_map_location_picker.dart';
import 'package:google_map_location_picker_example/keys.dart';

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

class MyApp extends StatefulWidget {
  _MyAppState createState() => _MyAppState();

class _MyAppState extends State<MyApp> {
  LocationResult _pickedLocation;

  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'location picker',
      home: Scaffold(
        appBar: AppBar(
          title: const Text('location picker'),
        body: Builder(builder: (context) {
          return Center(
            child: Column(
              children: <Widget>[
                  onPressed: () async {
                    LocationResult result = await LocationPicker.pickLocation(
                    print("result = $result");
                    setState(() => _pickedLocation = result);
                  child: Text('Pick location'),

Use this package as a library

1. Depend on it

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

  google_map_location_picker: ^1.0.5+2

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support 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:google_map_location_picker/google_map_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.

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

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.4


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/src/utils/loading_builder.dart. (-0.50 points)

Analysis of lib/src/utils/loading_builder.dart reported 1 hint:

line 63 col 16: This function has a return type of 'Widget', but doesn't end with a return statement.

Format lib/generated/i18n.dart.

Run flutter format to format lib/generated/i18n.dart.

Format lib/src/google_map_location_picker.dart.

Run flutter format to format lib/src/google_map_location_picker.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.2 <3.0.0
android_intent ^0.3.0+2 0.3.2
flutter 0.0.0
flutter_localizations 0.0.0
geolocator ^5.0.1 5.1.2
google_maps_flutter ^0.5.20+2 0.5.20+3
http ^0.12.0+1 0.12.0+2
intl ^0.15.8 0.15.8
intl_translation ^0.17.5 0.17.5
memoize ^2.0.0 2.0.0
provider ^3.0.0+1 3.0.0+1
Transitive dependencies
analyzer 0.36.4 0.38.0
args 1.5.2
async 2.3.0
charcode 1.1.2
collection 1.14.11 1.14.12
convert 2.1.1
crypto 2.1.1+1
csslib 0.16.1
dart_style 1.2.9
front_end 0.1.19 0.1.22
glob 1.1.7
google_api_availability 2.0.1
html 0.14.0+2
http_parser 3.1.3
kernel 0.3.19 0.3.22
location_permissions 2.0.2
meta 1.1.6 1.1.7
package_config 1.1.0
path 1.6.2 1.6.4
pedantic 1.8.0+1
petitparser 2.4.0
platform 2.2.1
pub_semver 1.4.2
sky_engine 0.0.99
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8
watcher 0.9.7+12
yaml 2.1.16
Dev dependencies