Untitled

 avatar
unknown
dart
3 years ago
799 B
1
Indexable
 Future<void> getAddress(bool twoPoints) async {
    if (!twoPoints) {
      await reverseGeocodingSearch(
              address.LatLon(_originLatitude, _originLongitude))
          .then((value) {
        setState(() {
          startAddress = value[0].formattedAddress;
          destinationAddress = "";
        });
      });
    } else {
      await reverseGeocodingSearch(
              address.LatLon(_originLatitude, _originLongitude))
          .then((value) {
        setState(() {
          startAddress = value[0].formattedAddress;
        });
      });
      await reverseGeocodingSearch(
              address.LatLon(_destLatitude, _destLongitude))
          .then((value) {
        setState(() {
          destinationAddress = value[0].formattedAddress;
        });
      });
    }
  }