class MapUtility {
static Future<void> openLocation(String placeId) async {
Uri googleUrl =
Uri.parse('https://www.google.com/maps/place/?q=place_id:$placeId');
if (!await launchUrl(googleUrl)) {
throw Exception("Could not open google map");
}
}
}
我正在尝试使用地点 ID 打开谷歌地图,但它不适用于 Android。在 ios 中,地图可以完美打开并显示所选地点。但在android中我得到
place_id:<place's id>
在搜索字段中。
来自 Android 设备的屏幕截图:
您可以使用map_launcher flutter启动带有place_id的谷歌地图。
查看额外参数这里。