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;
}
| Attribute | Type | Description |
|---|---|---|
| imageKey | String | Identification 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). |
| deviceScanSessionId | String | Identification 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;
}
| Attribute | Type | Description |
|---|---|---|
| statusCode | int? | HTTP status code of the error. |
| reason | String | Identifier of the error reason. |
| description | String | Detailed description of the error. |
Most common errors
| reason | statusCode | description |
|---|---|---|
INVALID_TOKEN | 401 | Authentication token expired or invalid — the clientSessionKey is invalid or has expired. |
USER_CANCELED | 0 | User 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');
}