getDetails method

Future<GoogleHTTPResponse<Place?>> getDetails({
  1. required String id,
  2. bool allFields = false,
  3. List<String>? fields,
  4. Place? instanceFields,
  5. PlaceDetailsFilter? filter,
})

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.

Required params:

  • id: The id of the place.
  • allFields or fields or instanceFields: A definition of the fields to be included in the response must be specified.

Documentation: https://developers.google.com/maps/documentation/places/web-service/place-details

Implementation

Future<GoogleHTTPResponse<Place?>> getDetails({
  /// Place identifier
  required String id,

  /// 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/place-details#fieldmask
  List<String>? fields,

  /// [Recommended] An instance of PlaceDetails 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/choose-fields#define_a_response_field_mask
  Place? instanceFields,

  /// Basic filters for specifying [languageCode], [regionCode] and [sessionToken]
  PlaceDetailsFilter? filter,
}) async {
  fields = _checkFields(
    allFields: allFields,
    fields: fields,
    placeDetailsFields: instanceFields,
  );
  return parseResponse(_service.getDetails(
    id: id,
    fields: fields,
    filter: filter,
  ));
}