reverse method Null safety

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

Reverse Geosearch

Implementation

Future<GoogleGeocodingResponse> reverse(
  String latlng, {
  String? locationType,
  String? resultType,
  String? language,
}) async {
  final Map<String, dynamic> query = <String, dynamic>{
    'latlng': latlng,
    'language': language,
    'result_type': resultType,
    'location_type': locationType,
  };
  query.removeWhere((_, dynamic value) => value == null);
  final Response<Map<String, dynamic>> response =
      await _dio.get<Map<String, dynamic>>(
    _baseUrl,
    queryParameters: query,
  );
  return GoogleGeocodingResponse.fromJson(response.data!);
}