Skip to main content

places_sdk_flutter 0.0.1 copy "places_sdk_flutter: ^0.0.1" to clipboard
places_sdk_flutter: ^0.0.1 copied to clipboard

Flutter plugin wrapping the official Google Places SDK on Android and iOS (autocomplete search + place details).

places_sdk_flutter #

Flutter plugin that wraps the Places SDK for Android and Places SDK for iOS. Requests run through the native SDKs (not the HTTP Places Web Service).

Published on pub.dev as places_sdk_flutter (the name google_places_flutter is already used by another package that calls the HTTP API).

Disclaimer: This is an unofficial package and is not affiliated with, endorsed by, or sponsored by Google.

Setup #

  1. Enable Places API (New) in Google Cloud Console.

  2. Create an API key and restrict it:

    • Android: package name + SHA-1
    • iOS: bundle identifier
  3. Add the key to your app (recommended — no key in Dart):

    Android — inside <application> in AndroidManifest.xml:

    <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="YOUR_PLACES_API_KEY" />
    

    iOS — in Info.plist:

    <key>GMSApiKey</key>
    <string>YOUR_PLACES_API_KEY</string>
    
  4. Android: minSdk 24+ (plugin default). Uses Places.initializeWithNewPlacesApiEnabled.

  5. iOS: deployment target 14.0+. CocoaPods pulls GooglePlaces (~> 8.5).

Usage #

Add to pubspec.yaml:

dependencies:
  places_sdk_flutter: ^0.0.1
import 'package:places_sdk_flutter/places_sdk_flutter.dart';

// Autocomplete (API key read from AndroidManifest / Info.plist)
final predictions = await searchPlace(
  query: 'coffee shop',
  countryCode: 'US', // optional ISO 3166-1 alpha-2
  limit: 5,
);

// Place details
final details = await getPlaceDetails(
  placeId: predictions.first.placeId,
);

print(details.name);
print(details.formattedAddress);
print(details.latitude);

API #

Function Native call
searchPlace Android: findAutocompletePredictions · iOS: findAutocompletePredictions
getPlaceDetails Android: fetchPlace · iOS: fetchPlace(fromPlaceID:)

Models: PlacePrediction, PlaceDetails.

Example app #

cd example
# Set YOUR_PLACES_API_KEY in example/android/.../AndroidManifest.xml
# and example/ios/Runner/Info.plist, then:
flutter run

Notes #

  • Autocomplete (New) on Android returns up to 5 predictions per request; limit only trims that list on the Dart side.
  • Billing follows Google Places SDK pricing; the plugin requests a fixed field set for details (name, address, location, phone, website, rating, hours, types, etc.).
  • Show required attributions when displaying Google place data in your UI.
0
likes
0
points
37
downloads

Publisher

verified publishersatpalyadav.in

Weekly Downloads

Flutter plugin wrapping the official Google Places SDK on Android and iOS (autocomplete search + place details).

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on places_sdk_flutter

Packages that implement places_sdk_flutter