idcheckio 8.0.1
idcheckio: ^8.0.1 copied to clipboard
A flutter plugin which simplify the integration of the IDCheck.io SDK into your flutter project.
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 '12.0' on the top of the file
# Uncomment this line to define a global platform for your project
platform :ios, '10.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'
- Retrieve the sdk using
pod install --repo-update
- ⚠️⚠️ You will need to have a
.netrc
file on your$HOME
folder setup with our credentials. 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 from the plugin project
PATH_TO_PLUGIN_FOLDER/android/build.gradle
, and replace$YOUR_USERNAME
and$YOUR_PASSWORD
with the credentials given by our support team.
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.
Future<void> activateSDK() async {
bool activationStatus = false;
try {
await _idcheckioPlugin.activate(
idToken: _activationToken,
extractData: true);
activationStatus = true;
} on PlatformException catch (e) {
activationStatus = false;
ErrorMsg errorMsg = ErrorMsg.fromJson(jsonDecode(e.message));
debugPrint("An error happened during the activation : ${errorMsg.cause} - ${errorMsg.details} - ${errorMsg.message}");
}
if (!mounted) return;
setState(() {
_sdkActivated = activationStatus;
});
}
- To start a capture of a document, use the
start()
method. You will receive the result in anIdcheckioResult
object.
Future<void> capture() async{
IDCheckioResult? result;
IDCheckioParams paramsLiveness = IDCheckioParams(
IDCheckioParamsBuilder()
..docType = DocumentType.LIVENESS
..orientation = IDCheckioOrientation.PORTRAIT
..confirmAbort = true
);
IDCheckTheme theme = IDCheckTheme(primaryColor: "purple");
try {
result = await _idcheckioPlugin.start(paramsLiveness, _captureResult?.onlineContext, theme);
debugPrint('ID Capture Successful : ${result!.toJson()}', wrapWidth: 500);
} on PlatformException catch(e) {
ErrorMsg errorMsg = ErrorMsg.fromJson(jsonDecode(e.message));
debugPrint("An error happened during the capture : ${errorMsg.cause} - ${errorMsg.message} - ${errorMsg.subCause}");
}
if (!mounted) return;
setState(() {
_captureResult = result;
});
}
- 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 succesful 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 {
IDCheckTheme theme = IDCheckTheme(primaryColor: "purple");
try {
await IDCheckio.startOnboarding(ipsController.text, theme);
} on PlatformException catch (e) {
ErrorMsg errorMsg = ErrorMsg.fromJson(jsonDecode(e.message));
debugPrint("An error happened during the ips session : ${errorMsg.cause} - ${errorMsg.message} - ${errorMsg.subCause}");
}
}
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");
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.