有没有办法从flutter应用程序中获取您当前的邮政编码?

vsnjm48y  于 11个月前  发布在  Flutter
关注(0)|答案(1)|浏览(109)

我如何从Flutter应用程序中根据用户的位置获取其邮政编码。

gijlo24d

gijlo24d1#

我研究了一下后发现了这个
https://pub.dev/packages/location_plus

Future<dynamic> getCurrentLocation() async {
var result = await LocationPlus.getCurrentLocation();
setState(() {
    print(result);
    _locality = result['locality'];
    _postalCode = result['postalCode'];
    _administrativeArea = result['administrativeArea'];
    _country = result['country'];
    _latitude = double.parse(result['latitude']);
    _longitude = double.parse(result['longitude']);
    _ipAddress = result['ipAddress'];
});
}

字符串
the _postalCode是邮政编码

相关问题