使用会话令牌限制 Flutter 中的国家和引用

Restrict Countries and Cites in Flutter using session token

下面的 url 字符串正确地给出了我所在国家/地区的位置:

String autocompleteURL="https://maps.googleapis.com/maps/api/place/autocomplete/json?input=$placeName&key=$mapKey&sessiontoken=1234567890&components=country:my";`  //no Error

'my' 给出了马来西亚的所有城市。 但是,我想将其限制在 malaysia.I 内的马六甲 不知道如何使用会话 token.I 为特定城市使用组件 google 从开发者网站搜索了自动完成文档。

之后我把上面的代码改成了:

String autocompleteURL= "https://maps.googleapis.com/maps/api/place/autocomplete/xml?input=$placeName&types=establishment&location=2.25386,-102.27273&radius=500&key=$mapKey"; //error after change.

但是,只有这一行在更改后给我错误。

这里的经度和纬度值是马六甲的值。 我在 flutter 中使用我的程序。

将输出类型从 xml 更改为 json :

String autocompleteURL= "https://maps.googleapis.com/maps/api/place/autocomplete/json?input=$placeName&types=establishment&location=2.25386,-102.27273&radius=500&key=$mapKey"; //error after change.