IDCheckio Sdk - Flutter plugin

Platform specific configuration

iOS

  1. In your project folder, go to your iOS directory and open the Podfile :
  • Change the minimum version to at least '14.0' on the top of the file
# Uncomment this line to define a global platform for your project
platform :ios, '14.0'
  • Add the following lines above the targetsection :
source 'https://github.com/CocoaPods/Specs.git'
source 'https://git-externe.rennes.ariadnext.com/idcheckio/axt-podspecs.git'

It gives you the source of public repo and IDnow ones.

  1. Retrieve the sdk using pod install --repo-update
  • ⚠️⚠️   You will need to have a .netrc file on your $HOME folder setup with the credentials given by our support team. Check the official documentation for more informations.  ⚠️⚠️
  1. In your project, open the *.plist file and the following entry :
  • "Privacy - Camera Usage Description" : "Camera is being used to scan documents"

Android

  1. Open your build file android/app/build.gradle :- In the android block, add the following lines :
packagingOptions {
    pickFirst 'META-INF/NOTICE'
    pickFirst 'META-INF/LICENSE'
    pickFirst 'META-INF/license.txt'
    pickFirst 'META-INF/notice.txt'
    pickFirst 'META-INF/DEPENDENCIES'
}
  1. In order to access our external nexus for retrieving the latest version of the IDCheck.io SDK, you have to update the gradle file your project your_app/android/build.gradle. Add these lines and replace my_username and my_password with the credentials given by our support team.
allprojects {
    repositories {
        ...
        maven {
            credentials {
                // Specify your own credentials to be able to import idcheckio SDK.
                username = "my_username"
                password = "my_password"
            }
            url "https://repoman.rennes.ariadnext.com/content/repositories/com.ariadnext.idcheckio/"
        }
    }

Usage

  1. Import the following file :
import 'package:idcheckio/idcheckio.dart';
  1. Before capturing any document, you need to activate the licence. you have to use the activate() method with your activation token. Here is an example of activation method in a viewModel which notify the view when result is given.
Future<void> activateSDK() async {
  try {
    activationStatus = ActivationStatus.activating;
    notifyListeners();
    await _idcheckioPlugin.activate(token: AppConstants.activationToken, extractData: false);
    activationStatus = ActivationStatus.activated;
    debugPrint("Activation ok");
    notifyListeners();
  } catch (e) {
    activationStatus = ActivationStatus.error;
    debugPrint("An error happened during the activation : $e");
    notifyListeners();
  }
}

Notes:

  • ActivationStatus is only an example local property which update the UI according to activation result.
  • notifyListeners() is used to notify the widget from this viewmodel.
  1. To start a capture of a document, use the start() method. You will receive the result in an IdcheckioResult object.
Future<void> _startCapture() async {
  IDCheckioResult? result;
  IDCheckioTheme theme = selectedTheme.theme;
  IDCheckioParams params = IDCheckioParams(
      docType: DocumentType.id,
      orientation: IDCheckioOrientation.portrait,
      integrityCheck: IntegrityCheck(readEmrtd: true, docLiveness: false),
      onlineConfig: OnlineConfig(isReferenceDocument: true));
  try {
    // Capture mode
    result = await _idcheckioPlugin.start(parameters: params, onlineContext: captureResult?.onlineContext, theme: theme);
    debugPrint('ID Capture Successful : ${result.toJson()}', wrapWidth: 500);
    alertResultTitle = "Your online session ended successfully ✅";
    alertResultDescription = "FolderUid = ${result.onlineContext?.folderUid} \nDocumentUid = ${result.onlineContext?.documentUid}";
  } on PlatformException catch (e) {
    IDCheckioError error = IDCheckioError.fromJson(jsonDecode(e.message!));
    alertResultTitle = "An error occurred during the capture ❌";
    alertResultDescription = "Cause: ${error.cause.value} \nSubcause: ${error.subcause?.value} \nMessage: ${error.message} \nDetails:  ${error.details}";
    debugPrint("An error happened during the capture : $e");
  }
  captureResult = result;

  shouldShowResult = true;
  notifyListeners();
}

Notes:

  • Here an example of an ID capture mode. Init SDKParams to work with other documents or properties. No more Builder used here, Params constructor is directly accessible.
  • alertResultTitle, alertResultDescription or captureResult are only example properties use to update the widget.
  1. If you want to start an onboarding session, you first need to create a new ips session by following the IPS documentation and then call the startIps method with the retrieved token. The result is empty when the capture is successful and an error is send otherwise. If you want to retrieve your data you need to check on ips the result of the capture.
  Future<void> _startOnboarding() async {
  try {
    await _idcheckioPlugin.startOnboarding(folderUid: "", theme: IDCheckioTheme(primaryColor: "axt_blue", borderColor: "white", foregroundColor: "white", backgroundColor: "axt_blue"););
    debugPrint("Start onboarding ok");
    alertResultTitle = "Your onboarding session ended successfully ✅";
  } on PlatformException catch (e) {
    IDCheckioError error = IDCheckioError.fromJson(jsonDecode(e.message!));
    alertResultTitle = "An error occurred during the capture ❌";
    alertResultDescription = "Cause: ${error.cause.value} \nSubcause: ${error.subcause?.value} \nMessage: ${error.message} \nDetails:  ${error.details}";
    debugPrint("An error happened during the onboarding session : $e");
  }
  shouldShowResult = true;
  notifyListeners();
}

Notes:

  • Replace folderUid if you have some. Otherwise its null.
  • Change the theme parameter by a custom one if you want. See the part bellow.
  • Again, shouldShowResult, alertResultTitle, alertResultDescription are only for example, it shows you how you can work with the result of onboarding.

Theming

If you want to change the colors of the sdk to match your theme, it's possible !

You need to create an IDCheckTheme() object with your own colors by providing the name of the color (name of the resource for Android and name of the Asset for iOS).

IDCheckTheme myTheme = IDCheckTheme(primaryColor: "blue", borderColor: "white", foregroundColor: "white", backgroundColor: "blue");

Provide null for the custom IDnow theme.

You're now good to go! ✅
To learn more about those methods and their parameters, please refer to the official IDCheck.io Mobile SDK documentation.