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:
1dependencies:
2 flutter:
3 sdk: flutter
4
5 gem_kit:
6 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:
1 allprojects {
2 repositories {
3 google()
4 mavenCentral()
5 maven {
6 url "${rootDir}/../plugins/gem_kit/android/build"
7 }
8 }
9 }
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
1android {
2 defaultConfig {
3 applicationId "com.magiclane.gem_kit.examples.example_pathname"
4 minSdk 21
5 targetSdk flutter.targetSdk
6 versionCode flutterVersionCode.toInteger()
7 versionName flutterVersionName
8 }
9 buildTypes {
10 release {
11 minifyEnabled false
12 shrinkResources false
13
14 // TODO: Add your own signing config for the release build.
15 // Signing with the debug keys for now, so `flutter run --release` works.
16 signingConfig signingConfigs.debug
17 }
18 }
19}
In the ios/Podfile
configuration file, at the top, set the minimum ios
platform version to 14 like this:
platform :ios, '14.0'
We recommend you to run these commands after you copy the gem_kit into your project:
flutter clean
flutter pub get
andcd ios
pod install
Then run the project:
flutter run --debug
orflutter run --release