FlPlaceAutocompleteWeb class

Web implementation using the Maps JavaScript API Places (New) library.

Session tokens are kept per Dart session id. Only placePrediction.toPlace() carries the session token into fetchFields, so the original JS prediction objects are cached by place id.

API key: when google.maps is not already on the page, the plugin loads the Maps JavaScript API itself with the --dart-define key (GOOGLE_PLACES_API_KEY_WEB, else GOOGLE_PLACES_API_KEY) by injecting Google's dynamic-loader bootstrap once. A Maps script already loaded by web/index.html always wins and is never replaced.

Inheritance
  • Object
  • PlatformInterface
  • FlPlaceAutocompleteWeb

Constructors

FlPlaceAutocompleteWeb({String? apiKey, @visibleForTesting String loaderSource(String apiKey) = buildLoaderSource})
Creates the platform.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

disposeSession(String sessionId) → Future<void>
Drops the native token for sessionId.
fetchPhoto(PlacePhotoRef ref, {int? maxWidth, int? maxHeight}) → Future<PhotoData>
Fetches a photo.
fetchPlace(String placeId, {String? sessionId, required Set<PlaceField> fields, String? languageCode, String? regionCode}) → Future<Place>
Fetches place details; ends the native session sessionId on success.
findPredictions(String input, {String? sessionId, required PredictionOptions options}) → Future<List<PlacePrediction>>
Fetches predictions. sessionId null means "no session".
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

registerWith(Registrar registrar) → void
Registers this implementation.