Google Places Autocomplete for Flutter
Getting Started #
Setting up #
- Run the
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:
[2.1.0+2] - 2019-12-31
- Changed onActivityResult return value so other plugins work.
[2.1.0+1] - 2019-12-31
- Removed memory leak introduced in latest update.
[2.1.0] - 2019-12-31
- Updated plugin to use v2 Android embedding
- Lowered Intent request code so it fits in the lower 16bits
- Updated Android Google Places SDK
[2.0.2+2] - 2019-09-16
- Fixed swapped north-east and south-west coordinated on
[2.0.2+1] - 2019-06-03
- Fixed Kotlin Smart Cast not working on certain setups.
[2.0.2] - 2019-05-24
- Updated Android Gradle and Kotlin versions.
[2.0.1] - 2019-04-20
- Added check for request code in
onActivityResultso we don't swallow other plugins' callbacks.
[2.0.0] - 2019-03-16
- Added option to filter options via type filter, restrict bounds, bias bounds and country.
[1.0.0] - 2019-03-16
- Removed Place Picker from plugin as it is deprecated by Google
[0.1.0] - 2019-01-19
- Fixed crashes on iOS devices when canceling the Place Picker or the Autocomplete
[0.0.9] - 2018-11-03
- Fixed more Android build errors
[0.0.8] - 2018-11-03
- Updated Kotlin version
[0.0.7] - 2018-11-03
- Fixed compile error on Flutter 0.10.x
[0.0.6] - 2018-09-21
- Fixed scenario where random point selected in the Place Picker would crash the app due to no address
[0.0.5] - 2018-09-03
- Updated sdk dependency for flutter 0.6.0
Demonstrates how to use the google_places_picker 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:
dependencies: google_places_picker: ^2.1.0+2
2. Install it
You can install packages from the command line:
$ 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:
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 Feb 12, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
- Dart: 2.7.1
- pana: 0.13.5
- Flutter: 1.12.13+hotfix.7
Health issues and suggestions
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.