Flutter Place Picker
Location picker for Flutter.
Usage
To use this plugin, add place_picker
as a dependency in your pubspec.yaml file.
Getting Started
This package relies on google_maps_flutter to display the map. Follow these guidelines to add your API key to the Android and iOS packages.
Get an API key at https://cloud.google.com/maps-platform/ if you haven't already.
Android
Specify your API key in the application manifest android/app/src/main/AndroidManifest.xml
and add ACCESS_FINE_LOCATION
permission:
Update your gradle.properties file with this:
Please also make sure that you have those dependencies in your build.gradle:
iOS
Specify your API key in the application delegate ios/Runner/AppDelegate.m
:
Or in your swift code, specify your API key in the application delegate ios/Runner/AppDelegate.swift
:
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
.
Also add these to the dict values in Info.plist
for location request to work on iOS
Sample Usage
Import the package into your code
Create a method like below, and call it in onTap
of a button or InkWell. A LocationResult
will be returned
with the name and lat/lng of the selected place. You can then handle the result in any way you want.