flutter - 在 flutter 上打开 Apple map 会给出无效的 URL 方案

标签 flutter apple-maps

在flutter中打开 map 的代码是这样的。它在谷歌上工作但没有启动苹果 map url。可能是小错误或遗漏了什么

                       String addrs = '';
                       addrs = '###';
                       String googleUrl =
                           'comgooglemaps://?q=${Uri.encodeComponent(addrs)}&center=lat,lng';
                       String appleUrl =
                           'https://maps.apple.com/?q=${addrs}&sll=lat,lng';
                       if (await canLaunch("comgooglemaps://")) {
                         print('launching com googleUrl');
                         await launch(googleUrl);
                       } else if (await canLaunch(appleUrl)) {
                         print('launching apple url');
                         await launch(appleUrl);
                       } else {
                         print('Could not launch url');
                       }```

最佳答案

请像对谷歌地图一样对苹果 map 的 URL 进行编码。

关于flutter - 在 flutter 上打开 Apple map 会给出无效的 URL 方案,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70936920/

相关文章:

flutter - Dart 中的批处理 future

Flutter 容器溢出

ios - 将地址 (UITextView) 连接到 Apple map

ios - MKLocalSearch 返回区域外的结果

api - 如何在 flutter 中获得估计的旅行时间和距离

ios - 添加一个按钮以打开Apple Maps以获取路线

flutter - 错误 : google_fonts was unable to load font

http - 如何在flutter http put方法中通过body传递参数

dart - 在 Flutter 中更新数据

ios - 允许在 cordova 中通话(以及 map 和邮件)