iOS Flutter Wrapper

Integrate IDmission's IDentity SDK into your iOS Flutter application.

Prerequisites

  • Flutter 3.38.0 or later — Flutter installation guide →
  • Xcode with iOS 15.6 deployment target
  • CocoaPods — sudo gem install cocoapods
  • Do not use the macOS system Ruby. Use a version manager such as rbenv or rvm.

Setup

  1. 1

    Add the plugin as a git dependency in your app's pubspec.yaml, then fetch it.

    YAML
    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
    Shell
    flutter pub get
  2. 2

    Replace the entire contents of ios/Podfile with the following.

    Why use_modular_headers! instead of use_frameworks!? The IDentity SDK is a pre-compiled .xcframework Using use_frameworks! globally causes linker conflicts.
    Ruby — ios/Podfile
    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
  3. 3

    Install pods. This downloads the IDentity SDK frameworks — allow several minutes on a clean install.

    Shell
    cd ios
    LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 pod install
    cd ..
    The 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.
  4. 4

    Add the required permission keys to ios/Runner/Info.plist. All three are required — a missing key causes an immediate crash on iOS 14+.

    XML — Info.plist
    <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>
  5. 5

    Connect a physical iOS device. In Xcode, open Runner.xcworkspace, select the Runner target, go to Signing & Capabilities, and set your Team. Then run:

    Shell
    flutter run
    The IDentity SDK requires a physical device — the iOS Simulator does not support camera capture and will not run the SDK flows.

Available Functions

Import the package and follow this pattern for every service call:

Dart — usage pattern
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();
Initidm_sdk_init

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.

Dart
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
);
InfogetSDKInfo

Returns the SDK version and the names of the models in use. models is empty until the SDK has been initialized.

Dart
final info = await FlutterPluginIdentitySdk.getSDKInfo();
// info['version'] : SDK version
// info['models']  : [{'name': ..., 'value': ...}, ...]
Serviceidm_sdk_serviceID20

Initiates the ID Validation (Service ID 20) flow. Captures and validates a government-issued ID document.

Dart
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();
Serviceidm_sdk_serviceID10

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.

Dart
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();
Serviceidm_sdk_serviceID185

Initiates the Identify Customer (Service ID 185) flow. Identifies an unknown individual against enrolled customer profiles.

Dart
await FlutterPluginIdentitySdk.idm_sdk_serviceID185();
await FlutterPluginIdentitySdk.submit_result();
Serviceidm_sdk_serviceID660

Initiates the Live Face Check (Service ID 660) flow. Performs liveness detection without document capture.

Dart
await FlutterPluginIdentitySdk.idm_sdk_serviceID660();
await FlutterPluginIdentitySdk.submit_result();
Serviceidm_sdk_serviceID50

Initiates the ID Validation and Customer Enrollment (Service ID 50) flow. Validates an ID document and enrolls the customer biometric profile.

Dart
await FlutterPluginIdentitySdk.idm_sdk_serviceID50(int uniqueCustomerNumber);
await FlutterPluginIdentitySdk.submit_result();
Serviceidm_sdk_serviceID175

Initiates the Customer Biometric Enrollment (Service ID 175) flow. Enrolls or updates a customer's biometric profile without document capture.

Dart
await FlutterPluginIdentitySdk.idm_sdk_serviceID175(int uniqueCustomerNumber);
await FlutterPluginIdentitySdk.submit_result();
Serviceidm_sdk_serviceID105

Initiates the Customer Verification (Service ID 105) flow. Verifies a returning customer against their enrolled biometric profile.

Dart
await FlutterPluginIdentitySdk.idm_sdk_serviceID105(int uniqueCustomerNumber);
await FlutterPluginIdentitySdk.submit_result();
Submitsubmit_result

Submits the captured data and finalizes the current service flow. Call after every service.

Dart
await FlutterPluginIdentitySdk.submit_result();

Upgrading from the zip install

If your app was set up from FlutterSDK2iOSResources.zip, switch to the GitHub package. It replaces the files you copied from the zip.

  1. 1

    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.

  2. 2

    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.

  3. 3

    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:

    Shell
    cd ios
    rm -rf Pods Podfile.lock
    LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 pod install --repo-update
    cd ..
  4. 4

    Your existing Dart code keeps working. Run your app on a device and test one service.