Integrate IDmission's IDentity SDK into your iOS Flutter application.
sudo gem install cocoapodsAdd the plugin as a git dependency in your app's pubspec.yaml, then fetch it.
dependencies:
flutter:
sdk: flutter
flutter_plugin_identity_sdk:
git:
url: https://github.com/Idmission-LLC/SDK2Flutter.git
ref: v11.1.19
path: flutter_plugin_identity_sdk
flutter pub get
Replace the entire contents of ios/Podfile with the following.
use_modular_headers! instead of use_frameworks!? The IDentity SDK is a pre-compiled .xcframework Using use_frameworks! globally causes linker conflicts.platform :ios, '15.6'
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(
File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__
)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. " \
"Run flutter pub get first."
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. " \
"Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(
File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root
)
flutter_ios_podfile_setup
target 'Runner' do
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
pod 'IDentityMediumSDK2.0'
target 'RunnerTests' do
inherit! :search_paths
end
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
Install pods. This downloads the IDentity SDK frameworks — allow several minutes on a clean install.
cd ios
LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 pod install
cd ..
LANG and LC_ALL prefixes prevent a Unicode Normalization not appropriate for ASCII-8BIT error. Add export LANG=en_US.UTF-8 to your ~/.zshrc to avoid needing them every time.Add the required permission keys to ios/Runner/Info.plist. All three are required — a missing key causes an immediate crash on iOS 14+.
<key>NSCameraUsageDescription</key>
<string>Camera access is required to capture identity documents and verify your face.</string>
<key>NSMicrophoneUsageDescription</key>
<string>Microphone access may be required during identity verification.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Photo library access is required to select identity documents for verification.</string>
Connect a physical iOS device. In Xcode, open Runner.xcworkspace, select the Runner target, go to Signing & Capabilities, and set your Team. Then run:
flutter run
Import the package and follow this pattern for every service call:
import 'package:flutter_plugin_identity_sdk/flutter_plugin_identity_sdk.dart';
// 1. Initialise once before calling any service
await FlutterPluginIdentitySdk.idm_sdk_init(apiBaseUrl, 'n', accessToken);
// 2. Call a service
final result = await FlutterPluginIdentitySdk.idm_sdk_serviceID10('y', 12345);
// 3. Submit the result
await FlutterPluginIdentitySdk.submit_result();
Initializes the SDK. Must be called before any other function. Returns “SDK Successfully Initialized” on success (the same text on iOS and Android), or “Error” / an error message on failure.
await FlutterPluginIdentitySdk.idm_sdk_init(
String apiBaseUrl, // API base URL — provided by IDmission
String debug, // 'y' turns on verbose SDK logging; use 'n' in production
String accessToken, // your IDmission access token
// Optional named parameters — these are the defaults:
String language = 'en', // 'en' or 'es' (Android also 'my' and 'ar')
bool enableGPS = true, // capture GPS location with submissions
bool geolocationRequired = false, // block the flow if location access is denied
bool isUpdateModelsData = true, // download the latest SDK models after credential verification
bool enableScreenRecording = false, // allow screen recording / screenshots during capture
);Returns the SDK version and the names of the models in use. models is empty until the SDK has been initialized.
final info = await FlutterPluginIdentitySdk.getSDKInfo();
// info['version'] : SDK version
// info['models'] : [{'name': ..., 'value': ...}, ...]
Initiates the ID Validation (Service ID 20) flow. Captures and validates a government-issued ID document.
await FlutterPluginIdentitySdk.idm_sdk_serviceID20(
String captureBack, // 'y' captures front and back, 'n' front only
int clientTraceId, // your unique integer trace ID for this transaction
);
await FlutterPluginIdentitySdk.submit_result();Initiates the ID Validation and Face Match (Service ID 10) flow. Captures an ID document and performs a liveness face match against the photo on the ID.
await FlutterPluginIdentitySdk.idm_sdk_serviceID10(
String captureBack, // 'y' captures front and back, 'n' front only
int clientTraceId, // your unique integer trace ID for this transaction
);
await FlutterPluginIdentitySdk.submit_result();Initiates the Identify Customer (Service ID 185) flow. Identifies an unknown individual against enrolled customer profiles.
await FlutterPluginIdentitySdk.idm_sdk_serviceID185();
await FlutterPluginIdentitySdk.submit_result();Initiates the Live Face Check (Service ID 660) flow. Performs liveness detection without document capture.
await FlutterPluginIdentitySdk.idm_sdk_serviceID660();
await FlutterPluginIdentitySdk.submit_result();Initiates the ID Validation and Customer Enrollment (Service ID 50) flow. Validates an ID document and enrolls the customer biometric profile.
await FlutterPluginIdentitySdk.idm_sdk_serviceID50(int uniqueCustomerNumber);
await FlutterPluginIdentitySdk.submit_result();Initiates the Customer Biometric Enrollment (Service ID 175) flow. Enrolls or updates a customer's biometric profile without document capture.
await FlutterPluginIdentitySdk.idm_sdk_serviceID175(int uniqueCustomerNumber);
await FlutterPluginIdentitySdk.submit_result();Initiates the Customer Verification (Service ID 105) flow. Verifies a returning customer against their enrolled biometric profile.
await FlutterPluginIdentitySdk.idm_sdk_serviceID105(int uniqueCustomerNumber);
await FlutterPluginIdentitySdk.submit_result();Submits the captured data and finalizes the current service flow. Call after every service.
await FlutterPluginIdentitySdk.submit_result();If your app was set up from FlutterSDK2iOSResources.zip, switch to the GitHub package. It replaces the files you copied from the zip.
Delete your local copy of the plugin, usually the flutter_plugin_identity_sdk folder. In pubspec.yaml, replace its path: entry with the git entry from Step 1. Then run flutter clean and flutter pub get.
If you added Swift files from the zip to the Runner target, remove them from the Xcode project: FlutterPluginIdentitySdkPlugin.swift, IDentitySDKHelper.swift, ViewController.swift, SuccessViewController.swift and UserDefaults+IDentitySample.swift.
Replace your Podfile with the one in Step 2. The SDK no longer needs the GZIP and Google ML Kit pods or the cocoapods-user-defined-build-types lines. Then reinstall the pods:
cd ios
rm -rf Pods Podfile.lock
LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 pod install --repo-update
cd ..Your existing Dart code keeps working. Run your app on a device and test one service.