# Flutter Plugin

# Latest Release

Version 1.19.7 (Changelog)

# Installation

Add this to your package's pubspec.yaml file:

  flutter_idensic_mobile_sdk_plugin: ^1.19.7

Then run:

flutter pub get

Please, make sure you are using Kotlin 1.5 and API level 21 (Android 5.0) or higher in your android project.

# iOS

  1. Update ios/Podfile as follows:
platform :ios, '9.0'

source 'https://cdn.cocoapods.org/'
source 'https://github.com/SumSubstance/Specs.git'

# Enable MRTDReader (NFC) module 

Note: uncomment the ENV['IDENSIC_WITH_MRTDREADER'] line if you'd like to enable the MRTDReader module.

  1. Update Info.plist to create a description for the usage of the camera, microphone and the photo library:
plutil -insert "NSCameraUsageDescription" -string "Let us take a photo" ios/Runner/Info.plist
plutil -insert "NSMicrophoneUsageDescription" -string "Time to record a video" ios/Runner/Info.plist
plutil -insert "NSPhotoLibraryUsageDescription" -string "Let us pick a photo" ios/Runner/Info.plist

# MRTDReader (NFC)

The MRTDReader is a module that allows the sdk to detect and read the electronic chips placed on MRTD documents via NFC. For Android platform the module comes out of the box, while for iOS in order to enable please follow the instructions below.

  1. Update ios/Podfile:
# Enable MRTDReader (NFC) module 
  1. Open up the iOS project in XCode
xed ios/

Then do as follows:

2.1. Turn on Near Field Communication Tag Reading capability for your project’s target (here is how to)

2.2. Add to the application's Info.plist file:

<string>Let us scan the document for more precise recognition</string>

# Usage

Before launching make sure you did the Backend routines

⚠️ In case your dashboard is in Flows/Levels mode, see here for the initialization details.

# Setup

import 'package:flutter_idensic_mobile_sdk_plugin/flutter_idensic_mobile_sdk_plugin.dart';

void launchSDK() async {

  // From your backend get an access token for the applicant to be verified.
  // The token must be generated with `levelName` and `userId`,
  // where `levelName` is the name of a level configured in your dashboard.
  // The sdk will work in the production or in the sandbox environment
  // depend on which one the `accessToken` has been generated on.
  final String accessToken = "your_access_token";

  // The access token has a limited lifespan and when it's expired, you must provide another one.
  // So be prepared to get a new token from your backend.
  final onTokenExpiration = () async {
    // call your backend to fetch a new access token (this is just an example)
    return Future<String>.delayed(Duration(seconds: 2), () => "your new access token");

  final SNSStatusChangedHandler onStatusChanged = (SNSMobileSDKStatus newStatus, SNSMobileSDKStatus prevStatus) {
    print("The SDK status was changed: $prevStatus -> $newStatus");

  final snsMobileSDK = SNSMobileSDK.init(accessToken, onTokenExpiration)
    .withHandlers( // optional handlers
      onStatusChanged: onStatusChanged
    .withDebug(true) // set debug mode if required
    .withLocale(Locale("en")) // optional, for cases when you need to override the system locale

  final SNSMobileSDKResult result = await snsMobileSDK.launch();

  print("Completed with result: $result");

The return type of the snsMobileSDK.launch() method is the Future of SNSMobileSDKResult type. Use it to determine the SDK status upon its closure.

Here is an example of the result:

  success: false,
  status: SNSMobileSDKStatus.Failed,
  errorType: SNSMobileSDKErrorType.Unauthorized,
  errorMsg: "Unauthorized access with accessToken=[your access token]",
  actionResult: null

Please find a detailed description below.

# Launch

Next, you are able to use the launchSNSMobileSDK(), as defined above, in order to launch the SDK.

For example:

body: Center(
  child: Column(
    mainAxisAlignment: MainAxisAlignment.center,
    children: <Widget>[
        alignment: Alignment.center,
        child: RaisedButton(onPressed: () => launchSDK(),
        child: Text("Launch Sumsub SDK")),

# Dismission

Normally, the user closes the SDK themselves, but if you need to do it programmatically, here is the method for it:


# Advanced

# Configuration

If it's required, you could provide an email and/or a phone number those will be assigned to the applicant initially:

final snsMobileSDK = SNSMobileSDK.init(accessToken, onTokenExpiration)
    "email": "...",
    "phone": "..."

# Events

Various events happening along the processing could be delivered into an optional onEvent handler:

final SNSEventHandler onEvent = (SNSMobileSDKEvent event) {
  print("onEvent: $event");

final snsMobileSDK = SNSMobileSDK.init(accessToken, onTokenExpiration)
    onEvent: onEvent

Each Event has eventType and some parameters packed into payload map, for example:

  eventType: "StepInitiated",
  payload: {
    "idDocSetType": "IDENTITY"

# Possible events:

eventType payload Description
"applicantId": "$applicantId"
The applicant $applicantId has been loaded
"idDocSetType": "$idDocSetType"
Step $idDocSetType has been initiated
"idDocSetType": "$idDocSetType",
"isCancelled": false|true
Step $idDocSetType has been fulfilled or cancelled

# Applicant Actions

There is a special way to use the SDK in order to perform Applicant actions.

Only the Face authentication action is supported at the moment

In order to run the SDK in applicant action mode, you need to

  1. Associate your applicant level with a customization of Applicant actions type in your dashboard
  2. Make an Access Token with the userId, levelName and externalActionId parameters

When an action is completed the status will be set to .ActionCompleted and the result structure will contain the actionResult field that describes the outcome of the last invocation:

  success: true,
  status: SNSMobileSDKStatus.ActionCompleted,
  errorType: null,
  errorMsg: null,
  actionResult: SNSMobileSDKActionResult(
    actionId: "5f9186b8aee05c5fa1ae11bb",
    answer: SNSMobileSDKAnswerType.Green

An empty value of actionResult.answer means that the action was cancelled.

# Action Result Handler

In addition, there is an optional onActionResult handler, that allows you to handle the action's result upon it's arrival from the backend. The user sees the "Processing..." screen at this moment.

final SNSActionResultHandler onActionResult = (SNSMobileSDKActionResult result) {
  print("onActionResult: $result");

  // you must return a `Future` that in turn should be completed with a value of `SNSActionResultHandlerReaction` type
  // you could pass `.Cancel` to force the user interface to close, or `.Continue` to proceed as usual
  return Future.value(SNSActionResultHandlerReaction.Continue);

final snsMobileSDK = SNSMobileSDK.init(accessToken, onTokenExpiration)
    onActionResult: onActionResult

# API Reference

# SNSMobileSDKResult

An object describing the result of the last SDK launch:

Field Type Description
success bool The boolean value indicates whether there was an error at the moment the SDK was closed. Use errorType and errorMsg to see the reasons of the error, if there is one
status SNSMobileSDKStatus SDK status expressed with SNSMobileSDKStatus enum
errorType SNSMobileSDKErrorType? Error reason expressed with SNSMobileSDKErrorType enum
errorMsg String? A verbose error description
actionResult SNSMobileSDKActionResult? Describes the result of the latest applicant action's invocation, if any

# SNSMobileSDKStatus

An enum describing the possible SDK statuses:

Case Description
Ready SDK is initialized and ready to be presented
Failed SDK has failed for some reason (see errorType and errorMsg for details)
Initial No verification steps have been passed yet
Incomplete Some, but not all, of the verification steps have been completed
Pending Verification is pending
TemporarilyDeclined Applicant has been declined temporarily
FinallyRejected Applicant has been finally rejected
Approved Applicant has been approved
ActionCompleted Applicant action has been completed

# SNSMobileSDKErrorType

An enum describing the possible reasons for failure:

Case Description
Unknown Unknown or no failure
InvalidParameters An attempt to setup with invalid parameters
Unauthorized Unauthorized access detected (most likely accessToken is invalid or expired and couldn't be refreshed)
InitialLoadingFailed Initial loading from the backend has failed
ApplicantNotFound No applicant can be found for the given parameters
ApplicantMisconfigured Applicant has been found, but is misconfigured (most likely they lacks ID Docs)
InititlizationError An initialization error has occured
NetworkError A network error has occured (the user will be presented with the Network Oops screen)
UnexpectedError An unexpected error has occured (the user will be presented with the Fatal Oops screen)

# SNSMobileSDKEvent

An object that represents an event happening along the processing:

Field Type Description
eventType String Event type
payload Map Event payload

# SNSMobileSDKActionResult

An object that represents the applicant action's result:

Field Type Description
actionId String Applicant action identifier to check the results against the server
answer SNSMobileSDKAnswerType? Overall result expressed with SNSMobileSDKAnswerType enum

# SNSMobileSDKAnswerType

An enum describing the possible answers:

Case Description
Green Positive answer
Red Negative answer
Yellow Neutral answer
Error Something went wrong
Ignored The check had not ever been started

# SNSActionResultHandlerReaction

An enum describing the possible reactions passed back from the Action Result Handler:

Case Description
Continue Proceed as usual
Cancel Force the user interface to close
Last Updated: 7/25/2022, 7:05:18 PM