idcheckio 9.0.2 copy "idcheckio: ^9.0.2" to clipboard
idcheckio: ^9.0.2 copied to clipboard

A Flutter plugin used to integrate the IDCheck.io SDK in a flutter project.

IDCheckio Sdk - Flutter plugin #

Platform specific configuration #

iOS

  1. In your project folder, go to your iOS directory and open the project :
  • Import the iOS SDK with SPM using the link: https://git-externe.rennes.ariadnext.com/idcheckio/idcheckiosdk-release-ios

  • ⚠️⚠️   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 :
<!-- Camera permission -->
<key>NSCameraUsageDescription</key>
<string>Camera is being used to scan documents</string>

<!-- NFC permission -->
<key>NFCReaderUsageDescription</key>
<string>This app uses NFC to scan id documents</string>

<!-- NFC protocols -->
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
<array>
	<string>A0000002471001</string>
	<string>A0000002472001</string>
	<string>00000000000000</string>
</array>
  1. Add an entitlements file to your app:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>com.apple.developer.nfc.readersession.formats</key>
	<array>
		<string>TAG</string>
		<string>PACE</string>
	</array>
</dict>
</plist>

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;
  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);
    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: "");
    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.
  • Again, shouldShowResult, alertResultTitle, alertResultDescription are only for example, it shows you how you can work with the result of onboarding.

SDK Theming #

Please contact your CSM for further information about theming configuration.

1
likes
140
points
325
downloads

Publisher

verified publisheridnow.io

Weekly Downloads

A Flutter plugin used to integrate the IDCheck.io SDK in a flutter project.

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

collection, flutter, plugin_platform_interface

More

Packages that depend on idcheckio

Packages that implement idcheckio