IDCheckio Sdk - Flutter plugin
Platform specific configuration
iOS
- 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
target
section :
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.
- 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. ⚠️⚠️
- In your project, open the
*.plist
file and the following entry :
- "Privacy - Camera Usage Description" : "Camera is being used to scan documents"
Android
- Open your build file
android/app/build.gradle
:- In theandroid
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'
}
- 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_username
andmy_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
- 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:
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.
- To start a capture of a document, use the
start()
method. You will receive the result in anIdcheckioResult
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
orcaptureResult
are 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: "", 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.
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/idcheckio_theme
- 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