PlaceProvider class
Shared state provider for PlacePicker.
Holds the Google Maps Places/Geocoding service instances, the current
device position, camera state, selected place, and UI state flags.
Consumed via Provider throughout the widget tree.
- Inheritance
-
- Object
- ChangeNotifier
- PlaceProvider
Constructors
-
PlaceProvider(String apiKey, String? proxyBaseUrl, Client? httpClient, Map<
String, dynamic> apiHeaders) - Creates a PlaceProvider and initialises the underlying Google Maps web-service clients.
Properties
- cameraPosition → CameraPosition?
-
The current camera position as reported by the
GoogleMapwidget.no setter - currentPosition ↔ Position?
-
The most recently resolved device
Position, ornullif location has not been fetched yet or permission was denied.getter/setter pair - debounceTimer ↔ Timer?
-
Active debounce Timer for camera-move searches, or
null.getter/setter pair - desiredAccuracy ↔ LocationAccuracy?
-
Desired accuracy passed to
Geolocatorwhen fetching the current device position.getter/setter pair - geocoding ↔ GeocodingService
-
The Geocoding API service used for reverse-geocoding the camera position.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- isAutoCompleteSearching ↔ bool
-
truewhile an autocomplete-initiated search is in progress, which prevents a redundant camera-move search from firing.getter/setter pair - isOnUpdateLocationCooldown ↔ bool
-
Whether the "my location" button is currently in its cooldown period.
getter/setter pair
- isSearchBarFocused ↔ bool
-
Whether the search bar currently has keyboard focus.
getter/setter pair
- mapController ↔ GoogleMapController?
-
Controller for the underlying
GoogleMapwidget.getter/setter pair - mapType → MapType
-
The currently active
MapType.no setter - pendingInitialSearch ↔ bool
-
truewhen the initial search triggered byselectInitialPositionis still pending (waiting for the firstonCameraIdleafter map creation).getter/setter pair - pinState ↔ PinState
-
Current visual state of the map pin.
getter/setter pair
- places ↔ PlacesService
-
The Places API (New) service used for autocomplete and place-detail
lookups.
getter/setter pair
- placeSearchingState ↔ SearchingState
-
Whether a place search is currently in progress.
getter/setter pair
- prevCameraPosition → CameraPosition?
-
The camera position captured just before the most recent camera movement
started. Used to detect zoom-only changes.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selectedPlace ↔ PickResult?
-
The place that is currently selected / shown in the floating card.
getter/setter pair
- sessionToken ↔ String?
-
Session token used to group autocomplete queries and detail fetches into
a single billable session.
getter/setter pair
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
setCameraPosition(
CameraPosition? newPosition) → void -
Stores
newPositionas the current camera position without notifying listeners (called in the hot camera-move path). -
setMapType(
MapType mapType, {bool notify = false}) → void -
Sets
mapTypedirectly. Passnotify: trueto also call notifyListeners. -
setPrevCameraPosition(
CameraPosition? prePosition) → void -
Stores
prePositionas the previous camera position without notifying listeners (called in the hot camera-move path). -
switchMapType(
) → void -
Advances mapType to the next value in
MapType.values, skippingMapType.none, and notifies listeners. -
toString(
) → String -
A string representation of this object.
inherited
-
updateCurrentLocation(
{bool gracefully = false}) → Future< void> - Resolves the device's current GPS position and stores it in currentPosition.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
of(
BuildContext context, {bool listen = true}) → PlaceProvider -
Returns the nearest PlaceProvider ancestor from
context.