使用 place_id 从 flutter 应用程序打开谷歌地图

问题描述 投票:0回答:1
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 设备的屏幕截图:

android flutter google-maps
1个回答
0
投票

您可以使用map_launcher flutter启动带有place_id的谷歌地图。

查看额外参数这里

© www.soinside.com 2019 - 2024. All rights reserved.