【发布时间】:2020-10-23 23:14:54
【问题描述】:
我已经使用https://pub.dev/packages/google_maps_flutter 为地图构建了一个 Flutter 应用程序,我想根据https://medium.com/@shubham.narkhede8/flutter-google-map-with-direction-6a26ad875083 添加方向,但我需要获取 Google API 密钥,该密钥在构建时以不同方式注入应用程序取决于是 Android 还是 iOS。
我用谷歌搜索了大约一个小时,但我找不到 Flutter 或本地获取应用程序中 API 密钥的方法。有什么办法吗?
【问题讨论】:
-
您能说出您需要 API 密钥的用途吗?
-
是的,它在上面的第二个链接中:maps.googleapis.com/maps/api/directions/json?origin=${l1.latitude},${l1.longitude}&destination=${l2.latitude},${l2.longitude}&key=$ apiKey
-
不,从 google 获取 API 密钥不是我的问题。见上文。
-
如果您根据此medium.com/@shubham.narkhede8/… 文档添加了谷歌地图包,那么我认为您不需要在应用程序中获取 API 密钥。那么您能详细说明一下您的要求吗?
标签: google-maps flutter google-maps-flutter