startProcess method

Future<void> startProcess({
  1. required String faceApiUrl,
  2. String mode = "match",
  3. DocumentReaderConfig? documentReaderConfig,
  4. FaceSDKConfig? faceSDKConfig,
  5. dynamic onDocumentFetched(
    1. ScanResult
    )?,
  6. dynamic onFaceMismatch()?,
  7. dynamic onVerificationSuccess(
    1. ScanResult
    )?,
  8. dynamic onError(
    1. GetVerifiedException
    )?,
})

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,
        ),
      );
    }
  }
}