google_places_kit library

Google Places API (New) and Geocoding API for Flutter: autocomplete, place details, text and nearby search, photos, and address ↔ coordinates, with ready-made search widgets.

Classes

AccessibilityOptions
Wheelchair access. Each value is null when Google doesn't know.
AddressArea
An area a place is in or near.
AddressComponent
One part of an address, such as the city or the postal code.
AddressDescriptor
Where a place is, described by nearby landmarks and areas.
AiSummary
An AI-generated summary of a place or of its reviews.
AuthorAttribution
Who took a photo or wrote a review. Google requires you to show it next to the photo or review.
Coordinates
A point on the earth, in degrees.
EvChargeOptions
Chargers at an EV charging station.
EvConnectorGroup
Connectors of one type and charge rate.
FuelOptions
Fuel prices at a petrol pump.
FuelPrice
The price of one fuel.
GeocodingResult
One result from GooglePlaces.reverseGeocode or GooglePlaces.geocode.
GoogleMapsAttribution
The "Google Maps" attribution Google requires next to Places results shown without a Google map. The widgets in this package add it for you; use it when you show results in your own UI.
Links that open a place in Google Maps.
GooglePlaces
Google Places API (New) and Geocoding API.
Landmark
A landmark near a place, such as "across the road from Sassoon Dock".
LocationArea
An area on the map: a circle or a rectangle. Used to bias or restrict results to a place, such as the user's city.
Money
An amount of money.
A point to stop at when going to a place, such as an entrance.
OpeningHours
Opening hours of a place, or of a part of it (see type).
OpeningPeriod
One opening: from open to close.
OpeningTime
A time in the week, in the place's time zone.
ParkingOptions
Parking. Each value is null when Google doesn't know.
PaymentOptions
Accepted payment methods. Each value is null when Google doesn't know.
Place
A place from GooglePlaces.details, GooglePlaces.searchText or GooglePlaces.searchNearby.
PlaceAmenities
What a place offers. Each value is null when Google doesn't know.
PlaceAutocompleteController
The search logic of the ready-made widgets, without any UI, so you can build your own.
PlaceAutocompleteField
A search field that suggests places in a floating panel while the user types, and gives you the full Place when they pick one.
PlaceAutocompleteOptions
Filters for the suggestions in PlaceAutocompleteController and the search widgets. See GooglePlaces.autocomplete.
PlaceField
A field to ask for in GooglePlaces.details, GooglePlaces.searchText and GooglePlaces.searchNearby.
PlacePhoto
A photo of a place. Get an image URL for it with GooglePlaces.photoUrl.
PlaceReview
A review of a place.
PlaceSearchPage
A full-screen place search. It pops with the picked Place. Usually opened with showPlaceSearch.
PlaceSearchResults
The places from GooglePlaces.searchText, with a token for the next page. It is a normal list of Places.
PlacesKitTheme
Colors, shapes and text styles for the widgets in this package.
PlacesSession
Groups the autocomplete requests a user makes while typing with the GooglePlaces.details call for the place they pick.
PlaceSuggestion
One suggestion from GooglePlaces.autocomplete.
PlaceSuggestionSkeleton
A shimmering placeholder shaped like a PlaceSuggestionTile, shown while suggestions load.
PlaceSuggestionsPanel
The floating panel of PlaceAutocompleteField: a loading skeleton, the suggestions, "No places found" or the error, with the Google Maps attribution.
PlaceSuggestionTile
A suggestion row: an icon for the kind of place, the name with the typed part highlighted, the address below, and the distance if known.
PlaceTypeIcon
A rounded, tinted icon for the kind of place in types, such as a fork and knife for restaurants or a plane for airports. See placeTypeIcon.
PlusCode
A plus code: a short code for a location, usable where there are no street addresses.
PostalAddress
A postal address in the standard format, ready for a shipping form.
PriceRange
The usual price range of a place.
TextMatch
A part of a suggestion's text that matches what the user typed, as character offsets. Use it to show the match in bold.
Viewport
A rectangle on the map, such as the area to show for a place.

Enums

BusinessStatus
Whether a place is open for business.
LocationType
How exact a GeocodingResult.location is.
PlacesErrorCode
What went wrong in a PlacesException.
PriceLevel
How expensive a place is.

Extensions

AddressParts on List<AddressComponent>
Easy access to the usual address parts.

Functions

formatDistance(num meters) → String
Formats meters as "850 m" or "12.4 km".
highlightMatches(String text, List<TextMatch> matches, {TextStyle? style, TextStyle? matchStyle}) → TextSpan
text with the matches in matchStyle (bold by default), the way Google shows suggestions. Without matches, all of text is semi-bold.
placeTypeIcon(List<String> types) → IconData
The icon for the first type in types that has one, or a map pin.
showPlaceSearch(BuildContext context, {GooglePlaces? places, List<PlaceField> fields = PlaceField.basic, PlaceAutocompleteOptions options = const PlaceAutocompleteOptions(), String hintText = 'Search for a place', PlaceSuggestionBuilder? suggestionBuilder, Widget errorBuilder(BuildContext context, PlacesException error)?, WidgetBuilder? emptyBuilder, bool? showAttribution}) → Future<Place?>
Opens a full-screen place search and returns the picked place, or null if the user goes back.

Typedefs

PlaceFieldViewBuilder = Widget Function(BuildContext context, TextEditingController controller, FocusNode focusNode, bool loading)
Builds the text field of PlaceAutocompleteField. Use the given controller and focusNode; loading is true while a request runs.
PlaceSuggestionBuilder = Widget Function(BuildContext context, PlaceSuggestion suggestion, VoidCallback onSelected)
Builds one suggestion. Call onSelected when the user picks it.
PlaceSuggestionsViewBuilder = Widget Function(BuildContext context, List<PlaceSuggestion> suggestions, ValueChanged<PlaceSuggestion> onSelected)
Builds the whole suggestion list. Call onSelected with the suggestion the user picks.

Exceptions / Errors

PlacesException
An error from GooglePlaces.