Skip to main content
GuidesAPI ReferenceExamplesFAQ

Integrate the SDK

|

Note

If you don't already have an API key, you can Create an API key. This is not mandatory but highly recommended in order to be able to use all the functionalities of the SDK.

Download and unpack the SDK

Download the Maps SDK for Flutter archive from the Downloads section in the Dashboard.

Unzip the archive and look for the gem_kit folder. This is the Flutter SDK.

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.

The resulting folder structure might look like this:

├── android
├── ios
├── lib
├── plugins
│   └── gem_kit
├── pubspec.yaml
...

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
note

The Maps SDK for Flutter is currently available as a separate download. Support for Artifactory via the Pub package is not yet implemented. We plan to add SDK Dependency Management for a future release.

Native configuration

First, verify that the ANDROID_SDK_ROOT environment variable is set to the root path of your Android SDK.

In android/build.gradle.kts add the maven block as shown, within the allprojects block, for both debug and release builds:

allprojects {
repositories {
google()
mavenCentral()
maven {
url = uri("${rootDir}/../plugins/gem_kit/android/build")
}
}
}

In android/app/build.gradle.kts 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.kts, within the android block, add the buildTypes block as shown:

Replace example_pathname with the actual project pathname.

import java.util.Properties

val localProperties = Properties().apply {
val localPropertiesFile = rootProject.file("local.properties")
if (localPropertiesFile.exists()) {
localPropertiesFile.inputStream().use { input ->
load(input)
}
}
}

val flutterVersionCode = localProperties.getProperty("flutter.versionCode") ?: "1"
val flutterVersionName = localProperties.getProperty("flutter.versionName") ?: "1.0"

android {
defaultConfig {
applicationId "com.magiclane.gem_kit.examples.example_pathname"
minSdk = 21
targetSdk = flutter.targetSdkVersion.toString().toInt()
versionCode = flutterVersionCode.toInt()
versionName = flutterVersionName
}
buildTypes {
getByName("release") {
isMinifyEnabled = false
isShrinkResources = false
signingConfig = signingConfigs.getByName("debug")
}
}
}