Amir Kamali.
Amir Kamali.

Reputation: 11

Flutter I cant get address from geolocator

i can get location but i want to get address from this location . i use geolocator plugin and this is my _getAddress method :

 _getAddress() async {
   try {
      List<Placemark> placeMark = await 
      locator.placemarkFromCoordinates(
      _currentPosition.longitude, 
      _currentPosition.longitude);
      Placemark place = placeMark[0];
      setState(() {
        _currentAddress =
         "${place.locality}, ${place.postalCode}, 
         ${place.country}";
       });

   } catch (e) {
     print(e);
}

}

how can i do that ?

and i have all location permissions .

this is my error from catch :

PlatformException(ERROR_GEOCODING_COORDINATES, grpc failed, null)

Upvotes: 0

Views: 297

Answers (1)

BabC
BabC

Reputation: 1084

placemarkFromCoordinates is no longer in the geolocator lib :

https://pub.dev/packages/geolocator

enter image description here

Upvotes: 1

Related Questions