google_places_sdk

Last updated:

0 purchases

google_places_sdk Image
google_places_sdk Images
Add to Cart

Description:

google places sdk

google_places #
A flutter plugin for Google Places SDK with Android & iOS support.




Android
iOS




Support
SDK 16+
iOS 11+



Usage #
To use this plugin please add google_places to your pubspec.yaml file.
Initialize Plugin #
First, you need to initialize the plugin.
await GooglePlaces().initialize(
"Your maps key here",
locale: const Locale('ar'),
);
copied to clipboard
There you go, you can now use the plugin.
Change Locale #
You can change your locale.
await GooglePlaces().updateLocale(const Locale('en'));
copied to clipboard

Note that setting locale is only supported on Android. As iOS will use the device language.

Get autocomplete results #
After initializing the plugin, you can fetch auto complete search results from a query.
final List<AutocompletePrediction> results = await GooglePlaces().getAutoCompletePredictions('Great Pyramid of Giza');
copied to clipboard
Parameters:



Parameter
Type
Condition




query
String
Required


countryCodes
List<String>
Optional


locationBias
RectangularBounds
Optional


locationRestriction
RectangularBounds
Optional


placeTypes
List<PlaceType>
Optional


cancellationToken
CancellationToken
Optional



Get Place Details #
You can get place details by passing the id to plugin.
final PlaceDetails placeDetails = await GooglePlaces.fetchPlaceDetails('Your Place Id');
copied to clipboard
Parameters:



Parameter
Type
Condition




placeId
String
Required


placeFields
List<PlaceField>
Optional


cancellationToken
CancellationToken
Optional



Get Place Photo #
After fetching place details, you might need to fetch the place photo. Here's an example:
final Uint8List? photo = await GooglePlaces().fetchPlacePhoto(widget.metadata);
copied to clipboard
Cancelling Requests #
The plugin supports the cancellation of a requst to the Google API.
final token = CancellationToken();
final details = await GooglePlaces.fetchPlaceDetails('Your Place Id', cancellationToken: token);
await token.cancel();
copied to clipboard

Note that issuing a cancellation token does NOT guarantee that a particular request will be cancelled, and you may still be charged for the request even if no response is returned.


Note that this feature is supported only on Android.

Feature Support #



Feature
Android
iOS




Soft Localization




Device Localizations




Place Autocomplete




Place Details




Current Place




Place Photo




Request Cancellation





Platform Support #



Platform
Version




Android
SDK 16+


iOS
11+


Web
Not yet supported


Linux
Not yet supported


MacOS
Not yet supported


Windows
Not yet supported

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.