when method
dynamic
when({
- OnVideoMode? onVideoMode,
- OnPhotoMode? onPhotoMode,
- OnPreparingCamera? onPreparingCamera,
- OnVideoRecordingMode? onVideoRecordingMode,
- OnPreviewMode? onPreviewMode,
- OnAnalysisOnlyMode? onAnalysisOnlyMode,
Implementation
when({
OnVideoMode? onVideoMode,
OnPhotoMode? onPhotoMode,
OnPreparingCamera? onPreparingCamera,
OnVideoRecordingMode? onVideoRecordingMode,
OnPreviewMode? onPreviewMode,
OnAnalysisOnlyMode? onAnalysisOnlyMode,
}) {
return switch (this) {
(VideoCameraState state) => onVideoMode?.call(state),
(PhotoCameraState state) => onPhotoMode?.call(state),
(PreparingCameraState state) => onPreparingCamera?.call(state),
(VideoRecordingCameraState state) => onVideoRecordingMode?.call(state),
(PreviewCameraState state) => onPreviewMode?.call(state),
(AnalysisCameraState state) => onAnalysisOnlyMode?.call(state),
CameraState() => null,
};
}