Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR DART

how to get isoCode based on location in flutter

Future<String> getCountryName() async {
    Position position = await Geolocator().getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
    debugPrint('location: ${position.latitude}');
    final coordinates = new Coordinates(position.latitude, position.longitude);
    var addresses = await Geocoder.local.findAddressesFromCoordinates(coordinates);
    var first = addresses.first;
    return first.countryName; // this will return country name
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #isoCode #based #location #flutter
ADD COMMENT
Topic
Name
8+1 =