startProcess method
Future<void>
startProcess({
- required String faceApiUrl,
- String mode = "match",
- DocumentReaderConfig? documentReaderConfig,
- FaceSDKConfig? faceSDKConfig,
- dynamic onDocumentFetched()?,
- dynamic onFaceMismatch()?,
- dynamic onVerificationSuccess()?,
- dynamic onError()?,
Implementation
Future<void> startProcess({
required String faceApiUrl,
String mode = "match",
DocumentReaderConfig? documentReaderConfig,
FaceSDKConfig? faceSDKConfig,
Function(ScanResult)? onDocumentFetched,
Function()? onFaceMismatch,
Function(ScanResult)? onVerificationSuccess,
Function(GetVerifiedException)? onError,
}) async {
_onDocumentFetched = onDocumentFetched;
_onFaceMismatch = onFaceMismatch;
_onVerificationSuccess = onVerificationSuccess;
_onError = onError;
_mode = mode;
try {
if (documentReaderConfig != null) {
await documentReaderConfig.apply();
}
if (faceSDKConfig != null) {
await faceSDKConfig.apply();
}
docReaderSdkSteps.scan(
faceApiUrl: faceApiUrl,
mode: mode,
handleCompletion: handleCompletion,
);
} catch (e, stackTrace) {
if (_onError != null) {
_onError!(
ConfigurationException(
"Failed to apply configuration: $e",
code: core_error.ErrorCodes.invalidConfiguration,
originalError: e,
stackTrace: stackTrace,
),
);
}
}
}