idcheckio 9.0.2+1
idcheckio: ^9.0.2+1 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
- 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, call the
startOnboardingmethod and provide afolderUidwhich is the name you want for your folder in the CIS. If you don’t have a naming policy for your folder you can simply use a random UUID. The result is empty when the capture is successful and an error is sent otherwise.
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.
Accessibility #
The SDK introduces essential accessibility features at component level for Talkback and VoiceOver through our Design System.