Alamin Saikh
Alamin Saikh

Reputation: 1

Error message by flutter toast "Bad state: No element" using Geocoder2

I am trying to use Geocoder2 in my project and facing the issue as mentioned above, Here's how I am using it .

getAddressFromLatLng() async {
    try {
        GeoData data = await Geocoder2.getDataFromCoordinates(
          latitude: pickLocation!.latitude, 
          longitude: pickLocation!.longitude, 
          googleMapApiKey: mapKey,
        ); 

        setState(() {
          Directions userPickUpAddress = Directions();
          userPickUpAddress.locationLatitude = pickLocation!.latitude;
          userPickUpAddress.locationLongitude = pickLocation!.longitude;
          userPickUpAddress.locationName = data.address;
          Provider.of<AppInfo>(context, listen: false).updatePickUpLocationAddress(userPickUpAddress);
        });
      }


    } catch (e) {
      Fluttertoast.showToast(msg: e.toString());
    }
  }

Here is i expect Changes Location when i move the map. Please solve my problem and give me answer, I wait for it.

Upvotes: 0

Views: 32

Answers (0)

Related Questions