扑朔迷离
我正在做一个使用地方API和谷歌地图的项目,我希望用户在输入地方ID时能够得到一个地方地址。
我已经能够检索的地方ID使用geocode。
请问我如何使用地方ID获取地方地址?
使用 google_maps_webservice 包。
final geocoding = GoogleMapsGeocoding(
apiKey: '...........');
final response = await geocoding.searchByPlaceId('ChIJd8BlQ2BZwokRAFUEcm_qrcA');
final result = response.results[0].formattedAddress;
// Result will be: 277 Bedford Ave, Brooklyn, NY 11211, USA
记得在开发者控制台启用服务。