searchNearby method
Future<GoogleHTTPResponse<PlacesResponse?> >
searchNearby({
- bool allFields = false,
- List<
String> ? fields, - PlacesResponse? instanceFields,
- required NearbySearchFilter filter,
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.
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/nearby-search
Implementation
Future<GoogleHTTPResponse<PlacesResponse?>> searchNearby({
/// 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/nearby-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/nearby-search#fieldmask
PlacesResponse? instanceFields,
/// Filters for the search
required NearbySearchFilter filter,
}) async {
fields = _checkFields(
allFields: allFields,
fields: fields,
placeResponseFields: instanceFields,
);
return genericParseResponse(
_service.searchNearby(
fields: fields,
filter: filter,
),
dataType: PlacesResponse(places: []),
);
}