SDK reference · Flutter SDK / Flutter Getting Started

Installation

Install the Incode Onboarding Flutter SDK, configure the iOS and Android projects that consume it, and initialize the SDK. After initialization, see Common Implementation Patterns to start an onboarding session.

SDK variants

The SDK is distributed in several variants. Select a variant by pointing the ref field in your pubspec.yaml at the matching release branch (see Add the SDK to your project). Combined variants are not supported.

  • Standard: The default variant. No modifier.
  • -vc: Streams the camera feed during Selfie and ID scan.
  • -nfc: Reads data from a passport or ID chip via NFC.
  • -l: Manipulates locally stored identities. Required for 1:N FaceAuthMode.local Face Login.
  • -sna: Adds support for Silent Network Authentication. Note that it is only available starting from version 4.19.0.

Requirements

  • Flutter 3.16 or higher (recommended)
  • Flutter 1.20.0 minimum

Access prerequisites

The SDK is distributed from private Incode repositories, so access must be granted before installation succeeds. Contact your Incode representative to request both of the following for the GitHub account you will build with:

  • Access to the Incode-Technologies-Example-Repos GitHub organization, with GitHub authentication configured on your machine over SSH or HTTPS. flutter pub get resolves the SDK from a private Git repository, and iOS builds resolve the Incode CocoaPods podspec sources from the same organization.
  • A GitHub token with the read:packages scope for the android-omni-packages registry. This is the value that replaces GITHUB_TOKEN in the Android setup step below.

Add the SDK to your project

Add the SDK as a Git dependency in your pubspec.yaml. Use the block that matches the variant you need.

Standard variant

onboarding_flutter_wrapper:
  git:
    url: git@github.com:Incode-Technologies-Example-Repos/FlutterSampleApp.git
    ref: release/[VERSION]

Camera streaming variant (-vc)

onboarding_flutter_wrapper:
  git:
    url: git@github.com:Incode-Technologies-Example-Repos/FlutterSampleApp.git
    ref: release/[VERSION]-vc

NFC variant (-nfc)

onboarding_flutter_wrapper:
  git:
    url: git@github.com:Incode-Technologies-Example-Repos/FlutterSampleApp.git
    ref: release/[VERSION]-nfc

Local identities variant (-l)

onboarding_flutter_wrapper:
  git:
    url: git@github.com:Incode-Technologies-Example-Repos/FlutterSampleApp.git
    ref: release/[VERSION]-l

Silent Network Authentication variant (-sna)

onboarding_flutter_wrapper:
  git:
    url: git@github.com:Incode-Technologies-Example-Repos/FlutterSampleApp.git
    ref: release/[VERSION]-sna

Replace [VERSION] in the ref field with the release branch name (for example, release/4.18.0). To use an older version, replace [VERSION] with the specific release branch (for example, release/4.2.0).

iOS setup

After adding the SDK to your project, complete the following iOS-specific setup steps.

1. Verify Git LFS is installed

The Incode iOS pods ship large binary assets through Git LFS. Without it those files are fetched as text pointers, and the build fails later with an error that does not mention LFS. Install Git LFS and confirm it is active before running pod install:

git lfs install
git lfs version

2. Update the Podfile deployment target

In the ios folder, change your Podfile so it requires deployment target 13 or higher.

-platform :ios, '11.0'
+platform :ios, '13.0'

3. Add the Incode CocoaPods sources

At the top of the Podfile in the ios folder, add these source lines. CocoaPods uses them to resolve the Incode iOS pods, which requires the GitHub organization access described above in Access prerequisites.

+ source 'https://cdn.cocoapods.org/'
+ source 'git@github.com:Incode-Technologies-Example-Repos/IncdDistributionPodspecs.git'
+ source 'git@github.com:Incode-Technologies-Example-Repos/IncodeBridgeCommonPodspecs.git'

4. Install pods

Run pod install within the ios folder:

pod install

5. Add permission entries to Info.plist

Add the permission entries required by the modules you plan to use.

  • Camera modules (IdScan, SelfieScan, DocumentScan, VideoSelfie): NSCameraUsageDescription is mandatory.
  • Geolocation module: requires NSLocationWhenInUseUsageDescription.
  • VideoSelfie module voice consent step: requires NSMicrophoneUsageDescription.
  • NFCScan module: requires NFCReaderUsageDescription and NSNFCUsageDescription.

Android setup

After adding the SDK to your project, complete the following Android-specific setup steps.

1. Update app/build.gradle

In app/build.gradle, enable multiDexEnabled and set the minimum API level. Use API level 23, or API level 24 if you are using the video streaming dependency. Set compileSdkVersion to 36, which the SDK requires.

android {
+  compileSdkVersion 36

  defaultConfig {
    …
    multiDexEnabled true
    minSdkVersion 23
  }
}

Add the packaging exclusion required by the SDK's OkHttp 5.3.2 dependency:

android {
+  packaging {
+    resources {
+      excludes += ['META-INF/versions/9/OSGI-INF/MANIFEST.MF']
+    }
+  }
}

2. Configure the GitHub Packages repository

Modify your project's build.gradle to include the GitHub Packages repository. Replace GITHUB_TOKEN with the read:packages token from Access prerequisites.

allprojects {
  repositories {
    ...
+    maven { url "https://jitpack.io" }
+    maven {
+      url = uri("https://maven.pkg.github.com/Incode-Technologies-Example-Repos/android-omni-packages")
+      credentials {
+        username = "incode-customers"
+        password = "GITHUB_TOKEN"
+      }
+    }
    ...
  }
}

3. Set the Kotlin, AGP and Gradle versions

The SDK is compiled with Kotlin 2.2.21, so any module that compiles Kotlin source with the SDK on its classpath needs Kotlin Gradle plugin 2.2.21 or newer. compileSdk 36 additionally requires Android Gradle Plugin 8.9.1+ and Gradle 8.14.5+.

In android/settings.gradle:

plugins {
    id "dev.flutter.flutter-plugin-loader"
+    id "com.android.application" version "8.9.1" apply false
+    id "org.jetbrains.kotlin.android" version "2.2.21" apply false
}

In android/gradle/wrapper/gradle-wrapper.properties:

+ distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.5-bin.zip

If you set the Kotlin plugin through a buildscript block instead:

buildscript {
+    ext.kotlin_version = '2.2.21'

    dependencies {
        ...
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

4. Set the coroutines version (conditional)

The SDK requires kotlinx-coroutines 1.9.0 or newer. CameraX 1.6.1 pulls it in transitively, so no declaration is needed unless you pin coroutines explicitly:

implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.9.0'

5. Add optional dependencies for Face Login (conditional)

If you plan to use 1:N Face Login with FaceAuthMode.local, add the following dependencies to your app/build.gradle:

  • com.incode.sdk:model-liveness-detection:[VERSION]: enables local liveness detection.
  • com.incode.sdk:model-face-recognition:[VERSION]: enables local face recognition.

See Face Login for details on local authentication mode.

Update to the latest version

To update the SDK to the latest version, run one of the following:

flutter pub upgrade

or

flutter packages upgrade

If the iOS SDK version was updated, also run the following inside your ios folder:

pod install --repo-update
pod update IncdOnboarding

Initialize the SDK

Initialize the SDK before calling any other SDK methods. Incode provides your apiKey and apiUrl.

IncodeOnboardingSdk.init(
  apiKey: 'YOUR_API_KEY',
  apiUrl: 'YOUR_API_URL',
  testMode: false,
  onError: (String error) {
    IncodeSdkInitError? e = error.toIncodeSdkInitError();
    switch (e) {
      case IncodeSdkInitError.simulatorDetected:
        print('Incode init failed, simulator detected: $IncodeSdkInitError.simulatorDetected');
        break;
      case IncodeSdkInitError.testModeEnabled:
        print('Incode init failed, test mode enabled: $IncodeSdkInitError.testModeEnabled');
        break;
      default:
        print('Incode init failed: $error');
        break;
    }
  },
  onSuccess: () {
    // Update UI, safe to start Onboarding
    print('Incode initialize successfully!');
  },
);

Init parameters

The parameters most commonly set during initial integration are:

  • apiKey: String. Provided by Incode.
  • apiUrl: String. Provided by Incode.
  • testMode: bool. Set to true when running on a simulator.
  • onSuccess: Callback invoked when initialization succeeds. Safe to start onboarding from here.
  • onError: Callback invoked when initialization fails. Receives an error code String; possible values are listed in the IncodeSdkInitError enum: simulatorDetected, testModeEnabled, invalidInitParams, configError, and unknown.

The SDK supports additional optional parameters for logging, SDK mode, security, and analytics. See init on the API Reference page for the full parameter list. Tutorial screens are configured per module with showTutorials — see Modules.

Initializing without an API key

To initialize the SDK without an apiKey, provide only the apiUrl to the init method, then configure your OnboardingSessionConfiguration with a token. See Token-Based Setup for details.

Was this page helpful?