I'm using Location
library to get the latitude and longitude
https://pub.dev/packages/location
Location location = new Location();
var latitude = "";
var longitude = "";
LocationData _locationData;
_locationData = await location.getLocation();
latitude = _locationData.latitude.toString();
longitude = _locationData.longitude.toString();
But how can i convert this latitude and longitude to address.
CodePudding user response:
Use geocoder :
final coordinates = new Coordinates(latitude, longitude);
addresses = await Geocoder.local.findAddressesFromCoordinates(coordinates);
first = addresses.first;
print("${first.featureName} : ${first.addressLine}");
CodePudding user response:
try using plugin "https://pub.dev/packages/yandex_geocoder" in this plugin you just map your longitude and latitude and this plugin convert it on address.