Untitled

mail@pastecode.io avatar
unknown
dart
2 years ago
820 B
1
Indexable
Never
import 'package:google_geocoding/google_geocoding.dart' as address;

reverseGeocodingSearch(address.LatLon(_destLatitude, _destLongitude));

  void reverseGeocodingSearch(address.LatLon latlng) async {
    var googleGeocoding = address.GoogleGeocoding(googleAPiKey);
    var response = await googleGeocoding.geocoding.getReverse(latlng);
    if (response != null && response.results != null) {
      if (mounted) {
        setState(() {
          reverseGeocodingResults = response.results;

          destinationAddress = reverseGeocodingResults[0].formattedAddress;
          // reverseGeocodingResults[0].addressComponents[4].longName; //yunusun kullanması gereken paket
        });
      }
    } else {
      if (mounted) {
        setState(() {
          reverseGeocodingResults = [];
        });
      }
    }
  }