是否可以在 flutter 应用程序中缓存谷歌地图?

Mas*_*d H 6 android google-maps dictionary dart flutter

I\xe2\x80\x99m 制作一个 flutter 应用程序,我需要其中的谷歌地图,但每次我重新打开应用程序时它都会重新加载我想知道是否有办法在我的应用程序中缓存谷歌地图以防止重新加载

\n

Бол*_*аев 0

一种可能的解决方法可能是使用Maps Static API。它允许您拥有地图上某个区域的图像,可以下载该图像而无需加载整个地图。

\n

根据jabamataro \xe2\x80\x99s 评论,缓存违反了Google 地图政策 3.2.3(b)。所以,没有缓存

\n

使用示例:

\n
static String mapPreviewImage({double latitude, double longitude}) {\n    return \'https://maps.googleapis.com/maps/api/staticmap?center=&$latitude,$longitude&zoom=16&size=600x300&maptype=roadmap&markers=color:red%7Clabel:A%7C$latitude,$longitude&key=$GOOGLE_API_KEY\';\n  }\n
Run Code Online (Sandbox Code Playgroud)\n

因此,您可以使用返回的字符串作为 http 请求的 URL

\n