Add Magic Lane in your project ¶
Create Your Account ¶
First, create your Magic Lane account and get your API key token. See the Getting Started guide.
Download the SDK ¶
Download the Maps SDK for Flutter:
Maps SDK for FlutterExtract the SDK ¶
Unzip the downloaded file and look for the
gem_kit
folder. This is the Flutter SDK.
Move the SDK Directory ¶
Move the
gem_kit
directory into the
plugins
subdirectory of your project, such as
my_project/plugins
. If the
plugins
directory does not exist, create it.
Update the pubspec file ¶
In your pubspec.yaml file add the path to the gem_kit in your dependencies:
dependencies:
flutter:
sdk: flutter
gem_kit:
path: plugins/gem_kit
Native configuration ¶
Configure the native parts:
First, verify that the
ANDROID_SDK_ROOT
environment variable
is set to the root path of your android SDK.
In
android/build.gradle
add the
maven
block as shown,
within the
allprojects
block, for both debug and release builds:
allprojects {
repositories {
google()
mavenCentral()
maven {
url "${rootDir}/../plugins/gem_kit/android/build"
}
}
}
in
android/app/build.gradle
within the
android
block, in the
defaultConfig
block,
the android SDK version
minSdk
must be set as shown below.
Additionally, for release builds, in
android/app/build.gradle
,
within the
android
block, add the
buildTypes
block as shown:
Replace
example_pathname
with the actual project pathname
android {
defaultConfig {
applicationId "com.magiclane.gem_kit.examples.example_pathname"
minSdk 21
targetSdk flutter.targetSdk
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
minifyEnabled false
shrinkResources false
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
Then run the project:
flutter run --debug
orflutter run --release