getAddressByLatLng method

dynamic getAddressByLatLng()

Get address by LatLnt

Implementation

getAddressByLatLng() async {
  final position = ctMap.center;
  _progress.sink.add(true);

  try {
    final resp = await Dio().get(_replaceIt(
        text: _URL_LAT_LNG + _getExtraArgs(),
        remove: {
          '[LAT]': position.latitude.toString(),
          '[LON]': position.longitude.toString()
        }));

    _address.sink.add(
        MPAddress(formattedAddress: _extractAddress(resp), latLng: position));
  } catch (msg) {
    _address.sink.add(MPAddress(
        formattedAddress: theme.errorToFindAddress, latLng: position));
    _hasError = true;
  }

  _progress.sink.add(false);
}