PlacesAPINew class
API service for the Places API (New): https://developers.google.com/maps/documentation/places/web-service/op-overview
baseUrl is the base url of the API, by default it's 'https://places.googleapis.com',
but you could use some proxy base url to cache requests.
token is the token to be used in the requests, if you use this, you don't
need to use apiKey.
tokenCallback is a callback that returns the token to be used in the requests,
if you use this, you don't need to use apiKey or token.
apiKey is the api key to be used in the requests, if you use this, you
don't need to use token or tokenCallback.
connectTimeout is the maximum amount of time in milliseconds that the request
can take to establish a connection.
receiveTimeout is the maximum amount of time in milliseconds that the request
can take to receive data.
sendTimeout is the maximum amount of time in milliseconds that the request
can take to send data.
httpClientAdapter is the client adapter if you need to customize how http
requests are made, note you should use either IOHttpClientAdapter
on
dart:io
native platforms or BrowserHttpClientAdapter
on dart:html
web platforms.
errorLogger
is a logger for errors that occur during parsing of response data.
- Inheritance
-
- Object
- RestAPIService<
Place> - PlacesAPINew
Constructors
- PlacesAPINew.new({String? baseUrl, String? token, TokenCallback? tokenCallback, String? apiKey, Duration? connectTimeout, Duration? receiveTimeout, Duration? sendTimeout, HttpClientAdapter? httpClientAdapter, ParseErrorLogger? errorLogger})
Properties
- apiKey → String?
-
API key to be used on requests
finalinherited
- baseUrl → String
-
Base api url
finalinherited
- connectTimeout → Duration?
-
Timeout for requests.
finalinherited
- dataType → Place?
-
Generic Jsonable DataType to allow for parsing of JSON data
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- httpClientAdapter → HttpClientAdapter?
-
Set this adapter if you need control over http requests
finalinherited
- onInit → void Function()?
-
finalinherited
- receiveTimeout → Duration?
-
Timeout for receiving data.
finalinherited
- restAPI → RestAPI
-
RestAPI instance to be used by the service
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sendTimeout → Duration?
-
Timeout for sending data, like when using stream upload or Tus protocol.
finalinherited
- token → String?
-
API Authorization Bearer token
finalinherited
- tokenCallback → TokenCallback?
-
Callback to asynchronously get API Authorization Bearer token
finalinherited
Methods
-
buildPhotoUrl(
{String? apiKey, String? name, String? placeId, String? photoId, int? maxWidthPx, int? maxHeightPx}) → String -
Build photo url of a Place. This function will return the photo url with the necessary params to request the photo binary.
This function is ideal to be used directly with some
ImageWidget
likeImage.network
orCachedNetworkImage
so the image gets loaded directly from the url. Note: take into account the photo will be obtained after a redirect. -
dioErrorToCustomHttpResponse(
DioException error) → GoogleHTTPResponse -
inherited
-
dispose(
) → void -
inherited
-
genericParseResponse<
DataTypeGeneric> (Future futureResponse, {DataTypeGeneric? dataType}) → Future< GoogleHTTPResponse< DataTypeGeneric> > -
inherited
-
genericParseResponseAsList<
DataTypeGeneric extends Jsonable< (Object> ?>Future futureResponse, {DataTypeGeneric? dataType}) → Future< GoogleHTTPResponse< List< >DataTypeGeneric> > -
inherited
-
getDetails(
{required String id, bool allFields = false, List< String> ? fields, Place? instanceFields, PlaceDetailsFilter? filter}) → Future<GoogleHTTPResponse< Place?> > - Fetch details of a place. Once you have a place ID, you can request more details about a particular establishment or point of interest by initiating a Place Details (New) request. A Place Details (New) request returns more comprehensive information about the indicated place such as its complete address, phone number, user rating and reviews.
-
getPhotoBinary(
{String? name, String? placeId, String? photoId, int? maxWidthPx, int? maxHeightPx}) → Future< GoogleHTTPResponse< List< >int> ?> - Get photo binary of a Place.
-
getPlainPhotoUrl(
{String? name, String? placeId, String? photoId, int? maxWidthPx, int? maxHeightPx}) → Future< GoogleHTTPResponse< String> > - Get the photo url of a Place after redirect, this means the final photo url will not use the apiKey nor the place or photo id.
-
getSaveResponse<
ContainerDataTypeGeneric> (Future futureResponse) → Future< GoogleHTTPResponse> -
inherited
-
httpResponseToCustomHttpResponse(
HttpResponse response) → GoogleHTTPResponse -
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
parseResponse(
Future futureResponse) → Future< GoogleHTTPResponse< Place> > -
inherited
-
parseResponseAsList(
Future futureResponse) → Future< GoogleHTTPResponse< List< >Place> > -
inherited
-
searchAutocomplete(
{bool allFields = false, List< String> ? fields, PlacesSuggestions? instanceFields, required AutocompleteSearchFilter filter}) → Future<GoogleHTTPResponse< PlacesSuggestions?> > - Searches by text with multiple possible filters. The Autocomplete (New) service is a web service that returns place predictions and query predictions in response to an HTTP request. In the request, specify a text search string and geographic bounds that controls the search area.
-
searchNearby(
{bool allFields = false, List< String> ? fields, PlacesResponse? instanceFields, required NearbySearchFilter filter}) → Future<GoogleHTTPResponse< PlacesResponse?> > - Searches nearby a specified location and radius. A Nearby Search (New) request takes one or more place types, and returns a list of matching places within the specified area. A field mask specifying one or more data types is required. Nearby Search (New) only supports POST requests.
-
searchText(
{bool allFields = false, List< String> ? fields, PlacesResponse? instanceFields, required TextSearchFilter filter}) → Future<GoogleHTTPResponse< PlacesResponse?> > - Searches by text with multiple possible filters. Text Search (New) returns information about a set of places based on a string, for example, "pizza in New York" or "shoe stores near Ottawa" or "123 Main Street". The service responds with a list of places matching the text string and any location bias that has been set.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited