Skip to main content

Collecting the Responses

The startFaceRecon method returns a Future<FaceReconReturnValues>. No manual JSON decoding is needed — the plugin already delivers typed Dart objects.

FaceReconReturnValues

class FaceReconReturnValues {
final String imageKey;
final String deviceScanSessionId;
}
AttributeTypeDescription
imageKeyStringIdentification key of the provided image, which can be used in any other service of the QI Tech system. Important: store this value to send in the validation APIs (e.g. the Onboarding API).
deviceScanSessionIdStringIdentification key of the device scan session performed internally by the Face Recognition SDK, which can be used in any other service of the QI Tech system.

FaceReconException

On failure, the method throws a typed FaceReconException:

class FaceReconException implements Exception {
final int? statusCode;
final String reason;
final String description;
}
AttributeTypeDescription
statusCodeint?HTTP status code of the error.
reasonStringIdentifier of the error reason.
descriptionStringDetailed description of the error.

Most common errors

reasonstatusCodedescription
INVALID_TOKEN401Authentication token expired or invalid — the clientSessionKey is invalid or has expired.
USER_CANCELED0User canceled FaceRecon. — the user interrupted the flow before completing it.

Handling example

try {
final result = await plugin.startFaceRecon(
CaaSEnvironment.sandbox,
clientSessionKey,
);

print('Image key: ${result.imageKey}');
print('Device Scan Session Id: ${result.deviceScanSessionId}');
} on FaceReconException catch (e) {
print('Error executing FaceRecon:');
print('Status: ${e.statusCode}');
print('Reason: ${e.reason}');
print('Description: ${e.description}');
} catch (e) {
print('An unknown error occurred: $e');
}