【发布时间】:2023-01-21 17:57:09
【问题描述】:
How do i pass the value of lat and long in "location": "27.6710, 85.4298",
我正在尝试传递 lat 和 long 的值,这给了我用户的当前位置
【问题讨论】:
-
“位置”:“${lat.toString()}, ${long.toString()}”
标签: flutter dart google-maps
How do i pass the value of lat and long in "location": "27.6710, 85.4298",
我正在尝试传递 lat 和 long 的值,这给了我用户的当前位置
【问题讨论】:
标签: flutter dart google-maps
List myplacelist = [];
void getNearbyPlaces() async {
_determinePosition().then((value) async {
double lat = value.latitude;
double long = value.longitude;
var uri = Uri.https(
'trueway-places.p.rapidapi.com',
'/FindPlacesNearby',
{
"location": lat.toSring() + ", " + long.toSring(),
"type": "restaurant", "radius": "150 ",
"language": "en",
}
);
final response = await http.get(
uri,
headers: {
"X-RapidAPI-Key": "API Key Here", // <= add your api key
"X-RapidAPI-Host": "trueway-places.p.rapidapi.com",
"useQuerystring": "true",
}
);
Map data = jsonDecode(response.body);
myplacelist = data['results'];
});
}
笔记 :不要公开分享API Keys。
【讨论】: