Skip to content

hchris0/flutter_google_place_picker

 
 

Repository files navigation

flutter_google_place_picker

Google place picker for flutter.

##currently this plugin only support android

Getting Started

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.

About

Google place picker for flutter.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 47.3%
  • Swift 27.8%
  • Dart 24.9%