Flutter quickstart
Get face liveness detection running in your Flutter app in under five minutes.
Get face liveness detection running in your Flutter app in under five minutes.
What you'll build
A single button that launches the iLive liveness verification flow and returns a verdict with confidence scores. Camera capture, face detection, and on-device analysis all run natively — no server needed.
Requirements
| Requirement | Minimum |
|---|---|
| Flutter | 3.10.0+ |
| Dart | 3.0.0+ |
| Android min SDK | 26 (Android 8.0) |
| iOS | 14.0+ |
| JDK | 17 (for Android builds) |
Step 1: Add the plugin
pubspec.yaml:
Then run:
Step 2: Android setup
2a. Include native SDK modules
The Flutter plugin needs the native Android SDK modules. Add them to your app's Android settings:
android/settings.gradle.kts:
Also add the version catalog so the SDK modules can resolve their dependencies:
2b. Set min SDK and fix duplicate classes
android/app/build.gradle.kts:
2c. Add camera permission
android/app/src/main/AndroidManifest.xml:
2d. Add SDK model assets
The native SDK ships with a set of model files that need to be copied
into its assets directory. Your Android SDK bundle includes a models/
directory — copy its contents into
ilive-android-sdk/ilive-core/src/main/assets/models/ before your first
build. The SDK README lists the exact files.
2e. Set JDK 17
android/gradle.properties:
Step 3: Basic integration (5 lines)
Step 4: Full example
Configuration
Working with the result
Reading scores
Using the ICAO photo
Server-side attestation
Device support check
Before launching the flow, check if the device is compatible:
Custom UI with LivenessEngine
For full control over the user interface:
LivenessResult reference
| Field | Type | Description |
|---|---|---|
sessionId | String | Unique session identifier |
verdict | Verdict | pass, fail, or retry |
confidence | double | Weighted aggregate score (0.0–1.0) |
layerScores | List<LayerScore> | Per-layer breakdown |
retryHint | String? | User-facing suggestion on retry |
failureReason | String? | Internal reason on fail |
icaoPhoto | Uint8List? | JPEG passport photo (480×600) on pass |
photoQualityScore | double? | Photo quality (0.0–1.0) |
attestation | Attestation? | Signed payload |
encryptedFrameBundle | FrameBundle? | Encrypted frames for audit |
metadata | SessionMetadata | Duration, device, SDK version |
Face comparison
Compare the verified face against a reference photo (for example, an ID document):
For faster repeat comparisons, store the face embedding from the liveness result:
| Parameter | Default | Description |
|---|---|---|
threshold | 0.45 | Minimum similarity for a match (0.0–1.0) |
iOS setup
The Flutter plugin also supports iOS. Add to your ios/Podfile:
Copy the SDK model files into your iOS app bundle (same files as Android
— see Step 2d). Add camera permission to ios/Runner/Info.plist:
For the full iOS setup walk-through, see the iOS quickstart.
Platform support
| Platform | Status |
|---|---|
| Android | Fully supported |
| iOS | Fully supported |
| Web | Not supported (requires the web integration) |
| Desktop | Not supported |
Troubleshooting
MissingPluginException: The plugin isn't registered. Ensure
ilive_flutter is in your pubspec.yaml and run flutter pub get.
Supported on Android and iOS only.
Build error "Duplicate class org.tensorflow.lite": Add the
exclusion to your android/app/build.gradle.kts (see Step 2b).
App crashes on "Start Liveness Check": SDK model files are missing. See Step 2d.
White screen after analysis: Check logcat for SDK errors — usually a model file is missing or corrupted.
Face not detected in portrait mode: This is handled automatically. Ensure you're using the latest SDK version.
PlatformException on iOS: Ensure the native pod dependencies are
installed. Run cd ios && pod install after adding the plugin.