IDCheckio Sdk - Flutter plugin
Platform specific configuration
iOS
- 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
.netrcfile on your$HOMEfolder setup with the credentials given by our support team. Check the official documentation for more informations. ⚠️⚠️
- In your project, open the
*.plistfile 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>
- 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
- Open your build file
android/app/build.gradle:- In theandroidblock, 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'
}
- 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 replacemy_usernameandmy_passwordwith 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
- Import the following file :
import 'package:idcheckio/idcheckio.dart';
- 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:
ActivationStatusis only an example local property which update the UI according to activation result.notifyListeners()is used to notify the widget from this viewmodel.
- To start a capture of a document, use the
start()method. You will receive the result in anIdcheckioResultobject.
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,alertResultDescriptionorcaptureResultare only example properties use to update the widget.
- 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,alertResultDescriptionare 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.
Libraries
- idcheckio
- idcheckio_interface
- method_channel/idcheckio_method_channel
- method_channel/idcheckio_platform_interface
- method_channel/method_name
- models/error/idcheckio_error
- models/error/idcheckio_error_cause
- models/error/idcheckio_error_sub_cause
- models/idcheckio_params
- models/idcheckio_result
- models/json/argument_key
- models/json/params_key
- models/parameters/capture_mode
- models/parameters/cis_type
- models/parameters/codeline
- models/parameters/confirmation_type
- models/parameters/document_type
- models/parameters/extraction
- models/parameters/face_detection
- models/parameters/file_size
- models/parameters/idcheckio_orientation
- models/parameters/integrity_check
- models/parameters/language
- models/parameters/online_config
- models/result/document/document
- models/result/document/document_status
- models/result/document/field_data
- models/result/document/identity_document
- models/result/document/identity_document_field
- models/result/document/vehicle_registration_document
- models/result/document/vehicle_registration_field
- models/result/image_quality_status
- models/result/image_result
- models/result/image_status
- models/result/liveness_status
- models/result/online_context