requestWithLatLng static method
Implementation
static Future<Map<String, dynamic>> requestWithLatLng(
{required double latitude,
required double longitude,
required String language}) async {
final client = http.Client();
try {
http.Response? response = await get(
client: client,
url:
"${Config.url}&lat=$latitude&lon=$longitude&zoom=18&addressdetails=1&accept-language=$language");
if (response != null && response.statusCode == 200) {
return jsonDecode(utf8.decode(response.bodyBytes))
as Map<String, dynamic>;
} else {
return <String, dynamic>{};
}
} finally {
client.close();
}
}