Please note that this project is community driven and is not an official Mapbox product. We welcome feedback and contributions.
This Flutter plugin for mapbox-gl-native enables embedded interactive and customizable vector maps inside a Flutter widget by embedding Android and iOS views.
This project is available on pub.dev, follow the instructions to integrate a package into your flutter application.
We're compiling a list of apps using this SDK. If you want to be listed here, please open a PR and add yourself below (or open a ticket and we'll add you).
flutter doctor
git clone git@github.com:mapbox/flutter-mapbox-gl.git
cd flutter_mapbox/example && flutter run
This project uses Mapbox vector tiles, which requires a Mapbox account and a Mapbox access token. Obtain a free access token on your Mapbox account page.
Even if you do not use Mapbox vector tiles but vector tiles from a different source (like self-hosted tiles) with this plugin, you will need to specify any non-empty string as Access Token as explained below!
Add Mapbox read token value in the application manifest android/app/src/main/AndroidManifest.xml:
<application ...
<meta-data android:name="com.mapbox.token" android:value="YOUR_TOKEN_HERE" />
Add these lines to your Info.plist
<key>io.flutter.embedded_views_preview</key>
<true/>
<key>MGLMapboxAccessToken</key>
<string>YOUR_TOKEN_HERE</string>
Feature | Android | iOS |
---|---|---|
Style | ||
Camera | ||
Gesture | ||
User Location | ||
Symbol | ||
Circle | ||
Line | ||
Fill |
Support for offline maps is available by "side loading" the required map tiles and including them in your assets
folder.
Create your tiles package by following the guide available here.
Place the tiles.db file generated in step one in your assets directory and add a reference to it in your pubspec.yml
file.
assets:
- assets/cache.db
installOfflineMapTiles
when your application starts to copy your tiles into the location where Mapbox can access them. NOTE: This method should be called before the Map widget is loaded to prevent collisions when copying the files into place. try {
await installOfflineMapTiles(join("assets", "cache.db"));
} catch (err) {
print(err);
}
This README file currently houses all of the documentation for this Flutter project. Please visit mapbox.com/android-docs if you'd like more information about the Mapbox Maps SDK for Android and mapbox.com/ios-sdk for more information about the Mapbox Maps SDK for iOS.
This repository's example library is currently the best place for you to find reference code for this project.
We welcome contributions to this repository!
If you're interested in helping build this Mapbox/Flutter integration, please read the contribution guide to learn how to get started.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。