我如何从Flutter应用程序中根据用户的位置获取其邮政编码。
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是邮政编码
1条答案
按热度按时间gijlo24d1#
我研究了一下后发现了这个
https://pub.dev/packages/location_plus
字符串
the _postalCode是邮政编码