Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PlatformException when calling Geocoder.local.findAddressesFromCoordinates

How can I convert location latitude and longitude to a formated address? I'm trying with geocoder plugin but the line- await Geocoder.local.findAddressesfromCoordinates(coordinates) gives me an error with showing platform exception. I used this plugin more times and it worked nicely, but this time in all my projects it shows same error, please help to solve.

var coordinates = new Coordinates(latitude, longitude);
var addresses = 
await Geocoder.local.findAddressesFromCoordinates(coordinates);
var first = addresses.first;
var myAddress = first.addressLine;

** When I want to convert coordinates find this error :
Unhandled Exception: PlatformException(failed, Failed, null) show error Message**

like image 565
Bijoya_Banik Avatar asked Oct 24 '25 23:10

Bijoya_Banik


1 Answers

Use:

await Geocoder.google(your_API_Key).findAddressesFromCoordinates(coordinates);

Instead of:

await Geocoder.local.findAddressesFromCoordinates(coordinates);
like image 138
Ward Mraisheh Avatar answered Oct 26 '25 12:10

Ward Mraisheh