start method

Future<void> start({
  1. required LivenessDetectionOnFocusCallback onFocus,
  2. required LivenessDetectionOnFrameCallback onFrame,
  3. required LivenessDetectionOnInitializedCallback onInitialized,
  4. required LivenessDetectionOnFocusDroppedCallback onFocusDropped,
  5. required LivenessDetectionOnPromptCompletedCallback onPromptCompleted,
  6. required LivenessDetectionOnCountDownChangedCallback onCountDownChanged,
  7. required LivenessDetectionOnAllPromptsCompletedCallback onAllPromptsCompleted,
  8. required LivenessDetectionOptions options,
})

Initializes the camera and starts the scanning process.

When the camera is initialized onInitialized is called. After the initialization process, the scanning process begins and on every frame onFrame is called. When the camera detects a face in the center of frame, onFocus is called. After the user completed each prompt, onPromptCompleted is called.

Implementation

Future<void> start({
  required LivenessDetectionOnFocusCallback onFocus,
  required LivenessDetectionOnFrameCallback onFrame,
  required LivenessDetectionOnInitializedCallback onInitialized,
  required LivenessDetectionOnFocusDroppedCallback onFocusDropped,
  required LivenessDetectionOnPromptCompletedCallback onPromptCompleted,
  required LivenessDetectionOnCountDownChangedCallback onCountDownChanged,
  required LivenessDetectionOnAllPromptsCompletedCallback
      onAllPromptsCompleted,
  required LivenessDetectionOptions options,
}) async {
  await _methodChannel.invokeMethod('start', options.toMap());

  _registerEventListener(
    onFocus: onFocus,
    onFrame: onFrame,
    onInitialized: onInitialized,
    onFocusDropped: onFocusDropped,
    onPromptCompleted: onPromptCompleted,
    onCountDownChanged: onCountDownChanged,
    onAllPromptsCompleted: onAllPromptsCompleted,
  );
}