Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

flutter mapbox gl native

please note that this project is experimental and is not officially supported. we welcome feedback and contributions.

mapbox logo
mapbox logo

this flutter plugin for mapbox-gl-native enables embedded interactive and customizable vector maps inside of a flutter widget. this project plugin is in the early development stage. only android is supported for now.

a mapbox gl flutter package for creating custom maps
a mapbox gl flutter package for creating custom maps

getting started

android

following examples use mapbox vector tiles, which require a mapbox account and a mapbox access token. obtain a free access token on your mapbox account page. after you get the key, place it in the project’s android directory:

  • create a local.properties file with the following path: $project_dir/android/local.properties
  • add mapbox.accesstoken="your mapbox access token"
    token to the local.properties file.

demo app

  • install flutter and validate its installation with flutter doctor
  • buy this source with git download [email protected]:mapbox/flutter-mapbox-gl.git
  • run the app with cd flutter_mapbox/example && flutter run

new project

  • create new flutter project in your ide or via terminal
  • add mapbox_gl: ^0.0.1 dependency to pubspec.yaml file and get the package
  • add mapbox dependency and read token value in android module build.gradle file:
android {
    defaultconfig {
        // ...
        def mapboxaccesstoken = localproperties.getproperty('mapbox.accesstoken')
        buildconfigfield "string", "mapbox_access_token", "$mapboxaccesstoken"
    }
}

dependencies {
    // ...
    implementation "com.mapbox.mapboxsdk:mapbox-android-sdk:6.1.0-snapshot"
}
  • initialize mapbox in android mainactivity class:
override fun oncreate(savedinstancestate: bundle?) {
  // ...
  mapbox.getinstance(this, buildconfig.mapbox_access_token)
}
  • import mapbox widgets and add them to your widget tree
import 'package:mapbox_gl/controller.dart';
import 'package:mapbox_gl/flutter_mapbox.dart';
import 'package:mapbox_gl/overlay.dart';

Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Comments are closed.