Google Places Autocomplete for Flutter
initializemethod in your
initState(or anywhere it would only be called once) with your API keys as arguments:
import 'package:google_places_picker/google_places_picker.dart'; PluginGooglePlacePicker.initialize( androidApiKey: "YOUR_ANDROID_API_KEY", iosApiKey: "YOUR_IOS_API_KEY", );
You can use the plugin via the
showAutocomplete methods, which takes a PlaceAutocompleteMode paramater to know whether to display the fullscreen or the overlay control on Android (it has no effect on iOS). It returns a
Place object with the following properties:
As of 2019-01-27, the Place Picker has been deprecated by Google. As such, this plugin has removed that functionality. If you want to keep using it until 2019-07-29, when it will be completely disabled, switch to the
google_places_picker: git: url: https://github.com/derTuca/flutter_google_places_picker.git ref: legacy
The initialization steps for the old version of the plugin are as follows:
android/app/src/mainand add the following in between the
applicationopening and closing tag, replacing
YOUR_API_KEYwith your api key, which you can get from the Google Developer Console:
<meta-data android:name="com.google.android.geo.API_KEY" android:value="YOUR_API_KEY"/>
ios/Runner, and in the
didFinishLaunchingWithOptionsmethod add the following lines:
import GooglePlaces import GoogleMaps GMSPlacesClient.provideAPIKey("YOUR_API_KEY") GMSServices.provideAPIKey("YOUR_API_KEY")
@import GooglePlaces; @import GoogleMaps; [GMSPlacesClient provideAPIKey:@"YOUR_API_KEY"]; [GMSServices provideAPIKey:@"YOUR_API_KEY"];
onActivityResultso we don't swallow other plugins' callbacks.
Demonstrates how to use the google_places_picker plugin.
For help getting started with Flutter, view our online documentation.
Add this to your package's pubspec.yaml file:
dependencies: google_places_picker: ^2.0.1
You can install packages from the command line:
$ flutter packages get
Alternatively, your editor might support
flutter packages get.
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
|2.0.1||Apr 20, 2019|
|2.0.0||Mar 16, 2019|
|1.0.0||Mar 16, 2019|
|0.1.0||Jan 19, 2019|
|0.0.9||Nov 3, 2018|
|0.0.8||Nov 3, 2018|
|0.0.7||Nov 3, 2018|
|0.0.6||Sep 21, 2018|
|0.0.5||Sep 3, 2018|
|0.0.4||May 20, 2018|
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]
We analyzed this package on Apr 23, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
Detected platforms: Flutter
References Flutter, and has no conflicting libraries.
Document public APIs. (-1 points)
48 out of 48 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.
The package description is too short. (-10 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.