This guide covers everything you need to set up a development environment and contribute to the Mapbox Maps SDK for Flutter.
- Flutter SDK 3.27.0 or higher (Dart SDK 3.6.0+)
- Xcode (for iOS development) — iOS deployment target is 14.0+
- Android Studio or the Android SDK (API level 21+, compile SDK 35)
- A Mapbox account with a valid access token
You need two types of tokens:
- Secret token (
sk.*) — required to download Mapbox binary dependencies. - Public token (
pk.*) — used at runtime to authenticate with Mapbox APIs.
Add the following to ~/.netrc (create it if it doesn't exist):
machine api.mapbox.com
login mapbox
password <your-secret-token>
Set the SDK_REGISTRY_TOKEN environment variable, or add it to your gradle.properties:
SDK_REGISTRY_TOKEN=<your-secret-token>-
Clone the repository:
git clone git@github.com:mapbox/mapbox-maps-flutter.git cd mapbox-maps-flutter -
Create a
pubspec_overrides.yamlin the package root to reset workspace resolution:# pubspec_overrides.yaml resolution:
-
Fetch Flutter dependencies:
flutter pub get
-
Verify your environment is ready:
flutter analyze
The example app demonstrates the SDK's features and serves as the host for integration tests.
cd example
# Provide your public access token
flutter run --dart-define=ACCESS_TOKEN=pk.your_token_hereYou can also persist the token in .vscode/launch.json:
{
"configurations": [
{
"args": ["--dart-define", "ACCESS_TOKEN=pk.your_token_here"]
}
]
}