Skip to main content

ID Capture

Get the id capture module from the main AmaniSDK instance which you have previously initialized.

note

The parameter on the setType function is supplied by Amani to it's customers.

final AmaniSDK _amaniSDK = AmaniSDK();

// Since the platform plugins are async, you must create this function
Future<void> initSDK() async {
var idCapture = _amaniSDK.getIdCapture();
await idCapture.setType("XXX_ID_0");
}

//And call it here.

void initState() {
super.initState();
initSDK();
}

Later on the buttons onPressed

onPressed: () async {
final Uint8List imageData =
await _flutterAmanisdkV2Plugin.getIDCapture().start(IdSide.front);
// Do something with imageData
setState(() {
_imageData = imageData;
});
},

After you get the image data from the SDK, you can use it with Image.memory().

Enabling the Video Recording

We can record the capture process for the ID capture with a simple and single function

To use this feature, just call setVideoRecording(true) to enable the video recording before the capture process.

  await idCapture.setVideoRecording(true);

Detecting the hologram

We can also open the flash and close it after the hologram has detected on the ID.

To use this, just call setHologramDetection() before the capture process.

  await idCapture.setHologramDetection(true);

Capturing the NFC Data on iOS

ID Capture module has it's own NFC method on iOS for making things easier. To call it you must have captured the both front and back sides of the id since capturing NFC data requires information can be extracted from the MRZ data.

// After capturing the front and back side on the IdCapture
// Before calling upload
void iosStartNFCCapture() {
if (Platform.isIOS) {
_idCapture.startNFC().then((isNFCCaptureDone) {
if (isNFCCaptureDone) {
// nfc capture completed
// You can safely proceed to upload.
} else {
startNFCCapture();
}
}).catchError((err) {
// handle the error
});
}
}

Capturing the NFC data after the ID Capture on Android

On android, you must do the following steps to capturing the NFC data after the side that containing the MRZ is captured from the camera

// After capturing the front and back side on the IdCapture
// Before calling upload
void androidStartNFCCapture() {
// setAndroidUsesNFC sets a state on the NFCCaptureModule to get the MRZ Data from ID itself.
_idCapture.setAndroidUsesNFC(true).then(() {
_nfcCapture.startNFCListener(
onFinishedCallback: (isCaptureCompleted) {
// Capture is completed you can upload
setState(() {
_NFCCompleted = isCaptureCompleted;
_nfcCapture.stopNFCListener();
});
},
onErrorCallback: (errorString) {
// handle the read errors here
},
onScanStart: () {
// This callback will be invoked when an NFC tag found
}
)
}).catchError((err) {
// Handle the intialization errors here
});
}

Using the setAndroidUsesNFC doesn't require you to call the setType on the AndroidNFCCapture module.

note

If you want to use the NFC as a document please check out this section. :::