📌  相关文章
📜  如何根据 Flutter 中的位置获取 isoCode - Dart 代码示例

📅  最后修改于: 2022-03-11 14:48:06.297000             🧑  作者: Mango

代码示例1
Future 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
}