Google place picker for flutter.
Add dependancy:
# pubspec.yaml
dependencies:
flutter:
sdk: flutter
flutter_google_place_picker: <last-version>
asynchronously call launchPlacePicker which returns a hashmap containing place details:
PickPlace() async {
Map place;
// Platform messages may fail, so we use a try/catch PlatformException.
try {
place = await FlutterGooglePlacePicker.launchPlacePicker;
} 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)
return;
setState(() {
/*get values inside the map
place["name"];......
*/
_place = place.toString();
});
}
For Android:
Edit AndroidManifest.xml and add api key
<application>
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="Your API key"/>
</application>
For IOS:
Need help with ios
For help getting started with Flutter, view our online documentation.
For help on editing plugin code, view the documentation.