getAddressFromLatLong function
Implementation
Future<(String countryName, String stateName, String cityName)>
getAddressFromLatLong(double latitude, double longitude) async {
List<Placemark> placeMark =
await placemarkFromCoordinates(latitude, longitude).catchError((e) async {
log("===============>${e}");
throw errorSomethingWentWrong;
});
Placemark place = placeMark[0];
log("==========================${place.toJson()}=======================");
String countryName = '';
String stateName = '';
String cityName = '';
if (!place.locality.isEmptyOrNull) {
cityName = '${place.locality.validate()}';
}
if (!place.administrativeArea.isEmptyOrNull) {
stateName = '${place.administrativeArea.validate()}';
}
if (!place.country.isEmptyOrNull) {
countryName = "${place.country.validate()}";
}
return (countryName, stateName, cityName);
}