Please note that this project is community driven and is an official FlightMap product.
This Flutter plugin allows to show embedded interactive and customizable vector maps inside a Flutter widget. For the Android and iOS integration, we use flightmap-gl-native.
- Install Flutter and validate its installation with
flutter doctor
- Clone the repository with
git clone https://github.com/Jungle-Works/flutter-flightmap-sdk
- Add a FlightMap access token to the example app (see next section)
- Connect a mobile device or start an emulator, simulator or chrome
- Locate the id of a the device wi
th
flutter devices
- Run the app with
cd flutter_flightmap/example && flutter packages get && flutter run -d {device_id}
This project uses FlightMap vector tiles, which requires a FlightMap account and a FlightMap access token. Obtain a an access token on your FlightMap account page.
Even if you do not use FlightMap 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!
The recommended way to provide your access token is through the FlightMap
constructor's accessToken
parameter. Note that you should always use the same token throughout your entire app.
This project is available on pub.dev, follow the instructions to integrate a package into your flutter application. For platform specific integration, use the flutter application under the example folder as reference.
Feature | Android | iOS | Web |
---|---|---|---|
Style | ✅ | ✅ | ✅ |
Camera | ✅ | ✅ | ✅ |
Gesture | ✅ | ✅ | ✅ |
User Location | ✅ | ✅ | ✅ |
Symbol | ✅ | ✅ | ✅ |
Circle | ✅ | ✅ | ✅ |
Line | ✅ | ✅ | ✅ |
Fill |
Map styles can be supplied by setting the styleString
in the MapOptions
. The following formats are supported:
- Passing the URL of the map style. This can be one of the built-in map styles, also see
FlightMapStyles
or a custom map style served remotely using a URL that start with 'http(s)://' - Passing the style as a local asset. Create a JSON file in the
assets
and add a reference inpubspec.yml
. Set the style string to the relative path for this asset in order to load it into the map. - Passing the raw JSON of the map style. This is only supported on Android.
To enable location features in an Android application:
You need to declare the ACCESS_COARSE_LOCATION
or ACCESS_FINE_LOCATION
permission in the AndroidManifest.xml and starting from Android API level 23 also request it at runtime. The plugin does not handle this for you. The example app uses the flutter 'location' plugin for this.
To enable location features in an iOS application:
If you access your users' location, you should also add the following key to your Info.plist to explain why you need access to their location data:
<key>NSLocationWhenInUseUsageDescription</key>
<string>[Your explanation here]</string>
FlightMap recommends the explanation "Shows your location on the map and helps improve the map".
- Need help with your code?: Look for previous questions on the [#FlightMap tag]https://github.com/Jungle-Works/flutter-flightmap-sdk) — or ask a new question.
- Have a bug to report? Open an issue. If possible, include a full log and information which shows the issue.
- Have a feature request? Open an issue. Tell us what the feature should do and why you want the feature.