reverse method

Future<GoogleGeocodingResponse> reverse(
  1. String latlng, {
  2. String? locationType,
  3. String? resultType,
  4. String? language,
})

Implementation

Future<GoogleGeocodingResponse> reverse(
  String latlng, {
  String? locationType,
  String? resultType,
  String? language,
}) async {
  final Map<String, dynamic> query = <String, dynamic>{
    'latlng': latlng,
    if (language != null) 'language': language,
    if (resultType != null) 'result_type': resultType,
    if (locationType != null) 'location_type': locationType,
  };

  final Response<Map<String, dynamic>> response =
      await _dio.get<Map<String, dynamic>>(
    _baseUrl,
    queryParameters: query,
  );
  return _mapOrThrow(response.data!);
}