Skip to content

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 Flutter

Extract 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:

:lineno-start: 1

    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

:lineno-start: 1

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
        }
    }
}

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 |and |cd ios |pod install

Then run the project:

flutter run --debug
or
flutter run --release