flutter_places_dialog 1.0.5

  • Readme
  • Changelog
  • Example
  • Installing
  • 85

flutter_places_dialog #

Shows a places picker dialog in ios and android, returning the data in the places picker to the app.

Getting Started #

Generate your API Key #

  1. Go to: https://console.developers.google.com/
  2. Enable Google Maps Android API
  3. Enable Google Maps SDK for iOS
  4. Under Credentials, choose Create Credential.
    • Note: For development, you can create an unrestricted API key that can be used on both iOS & Android. For production it is highly recommended that you restrict.

The way you register your API key on iOS vs Android is different. Make sure to read the next sections carefully.

iOS #

The maps plugin will request your users location when needed. iOS requires that you explain this usage in the Info.plist file #

  1. Set the NSLocationWhenInUseUsageDescription in ios/Runner/Info.plist. Example:
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>Using location to display on a map</string>

Note: If your iOS and Android API key are different, be sure to use your iOS API key here.

  1. Add code to show the MapView.
    //Create an instance variable for the mapView
    var _place = await FlutterPlacesDialog.getPlacesDialog();
    
```
  1. Run your application on an iOS device or simulator. Confirm that when you display the map you see map detail. If you only see a beige screen it's possible that your API key is incorrect, or if it outright crashes.

Common API Key problems for iOS #

  1. Your Bundle ID does not match what is registered in the Google API Console. When you create an restricted API key in the Google API console it asks you to specify your iOS bundle ID. Make sure that your iOS Bundle Identifier matches the one you registered in the console.

  2. Using the wrong key. If you made a separate key for iOS and Android, make sure you are using the iOS key in the MapView.setApiKey() call.

Android #

You will be making multiple edits to your AndroidManifest.xml file. In your Flutter project, you can find this file location under android/app/src/main

  1. In your AndroidManifest.xml, add the following uses-permission above the

         <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
         <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    
  2. In your AndroidManifest.xml, add the following lines inside of the application tag. Be sure to replace your_api_key with the one you generated.

         <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="your_api_key"/>
         <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>
    
  3. In your android/build.gradle file. Under buildScript dependencies add:

         classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.2-4'
    
  4. Run your application on an Android device or simulator. Confirm that when you display the map you see map detail. If you only see a beige screen it's possible that your API key is incorrect.

Features #

  • [X] iOS Support
  • [X] Android Support

Usage examples #

Show the places picker ( with autocomplete ) #

  PlaceDetails place = await FlutterPlacesDialog.getPlacesDialog();

FAQ #

Dialog shows up and drops almost immediately #

Verify you have your google api key setup correctly. If using iOS you need to set this via the API call, on android you need to setup the google-services.json correctly in your app deployment or it will not correctly show the screen, dropping out basically immediately. You should get an error back from the api call to the client saying it dropped.

[0.0.1] - TODO: Add release date.

  • TODO: Describe initial release.

example/README.md

flutter_places_dialog_example #

Demonstrates how to use the flutter_places_dialog 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:
  flutter_places_dialog: ^1.0.5

2. Install it

You can install packages from the command line:

with Flutter:


$ 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:


import 'package:flutter_places_dialog/flutter_places_dialog.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
78
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
85
Learn more about scoring.

We analyzed this package on Oct 11, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health issues and suggestions

Document public APIs. (-1 points)

44 out of 44 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.

Format lib/flutter_places_dialog.dart.

Run flutter format to format lib/flutter_places_dialog.dart.

Maintenance suggestions

The package description is too short. (-20 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.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.19.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8