callGeoCodingApiMapbox method

void callGeoCodingApiMapbox()

Implementation

void callGeoCodingApiMapbox() async {
  String url = "https://api.mapbox.com/geocoding/v5/mapbox.places/$lng,$lat.json?access_token=${widget.mapboxKey}";

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

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

    if (obj['features'].length >= 1) {
      selectedAddress = obj['features'][0]['place_name'];
      //ToastMessage().showToast(msg: '${obj['features'][0]['place_name']}');
    }

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