searchText method
Future<GoogleHTTPResponse<PlacesResponse?> >
searchText({
- bool allFields = false,
- List<
String> ? fields, - PlacesResponse? instanceFields,
- required TextSearchFilter filter,
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.
Required params:
allFields
orfields
orinstanceFields
: A definition of the fields to be included in the response must be specified.filter
: Filters for the search.
Documentation: https://developers.google.com/maps/documentation/places/web-service/text-search
Implementation
Future<GoogleHTTPResponse<PlacesResponse?>> searchText({
/// If true, all fields will be included in the response. It's the same as using fields: ['*'].
/// Take into account including all fields is expensive in terms of quota usage and performance.
bool allFields = false,
/// List of fields to be included in the response by creating a response field mask: https://developers.google.com/maps/documentation/places/web-service/text-search#fieldmask
/// Take into account this function returns a list of [places], so the fields must be specified with the 'places.' hierarchy in mind, like 'places.id','places.displayName'.
List<String>? fields,
/// [Recommended] An instance of PlacesResponse where all fields that are not null will be used as the fields parameter taking into account the field hierarchy, as described here: https://developers.google.com/maps/documentation/places/web-service/text-search#fieldmask
PlacesResponse? instanceFields,
/// Filters for the search
required TextSearchFilter filter,
}) async {
fields = _checkFields(
allFields: allFields,
fields: fields,
placeResponseFields: instanceFields,
);
return genericParseResponse(
_service.searchText(
fields: fields,
filter: filter,
),
dataType: PlacesResponse(),
);
}