callGeoCodingApi method

void callGeoCodingApi()

Implementation

void callGeoCodingApi() async {
  String url = "https://maps.googleapis.com/maps/api/geocode/json?latlng=$lat,$lng&key=${widget.googleKey}";

  var response = await Locations().getSearchAddress(url,context);

  try {
    Map obj = json.decode(response);

    if (obj['results'].length >= 1) {
      selectedAddress = obj['results'][0]['formatted_address'];
    }

    setState(() {});
  } on Exception catch (exc) {
    debugPrint(exc.toString());
  }
}