when method

dynamic when({
  1. OnVideoMode? onVideoMode,
  2. OnPhotoMode? onPhotoMode,
  3. OnPreparingCamera? onPreparingCamera,
  4. OnVideoRecordingMode? onVideoRecordingMode,
  5. OnPreviewMode? onPreviewMode,
  6. OnAnalysisOnlyMode? onAnalysisOnlyMode,
})

Implementation

when({
  OnVideoMode? onVideoMode,
  OnPhotoMode? onPhotoMode,
  OnPreparingCamera? onPreparingCamera,
  OnVideoRecordingMode? onVideoRecordingMode,
  OnPreviewMode? onPreviewMode,
  OnAnalysisOnlyMode? onAnalysisOnlyMode,
}) {
  if (this is VideoCameraState && onVideoMode != null) {
    return onVideoMode(this as VideoCameraState);
  }
  if (this is PhotoCameraState && onPhotoMode != null) {
    return onPhotoMode(this as PhotoCameraState);
  }
  if (this is PreparingCameraState && onPreparingCamera != null) {
    return onPreparingCamera(this as PreparingCameraState);
  }
  if (this is VideoRecordingCameraState && onVideoRecordingMode != null) {
    return onVideoRecordingMode(this as VideoRecordingCameraState);
  }
  if (this is PreviewCameraState && onPreviewMode != null) {
    return onPreviewMode(this as PreviewCameraState);
  }
  if (this is AnalysisCameraState && onAnalysisOnlyMode != null) {
    return onAnalysisOnlyMode(this as AnalysisCameraState);
  }
}