首页 > 解决方案 > 在 Flutter Web 中显示地图

问题描述

我尝试在颤振网络中加载地图,但除了谷歌地图之外没有地图库可用于网络(我必须为此支付预算(计费))。

有免费的解决方案吗?

标签: flutterdictionarydartopenstreetmapflutter-web

解决方案


有多种解决方案:

1.1:添加flutter_mappubspec.ymal

1.2:将FlutterMap(TileLayerWidget(TileLayerOptions(urlTemplate:'')))小部件添加到您想要的任何页面

1.3:在urltemplate添加您感兴趣的地图地址提供者。例如 OSM 地图瓦片地址提供程序是

"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"

或 bing 地址地图提供者为“https://atlas.microsoft.com/map/tile/png?api-version=1&layer=basic&style=main&tileSize=256&view=Auto&zoom={z}&x={x}&y={y} &subscription-key={subscriptionKey}","

1.4:享受你的地图

2.1:使用mapbox lib https://pub.dev/packages/mapbox_gl


推荐阅读