BaseMixinFeatureCameraV2 mixin
BaseMixinFeatureCameraV2 is a mixin class designed to facilitate camera-related functionalities. It provides methods for handling essential camera features, such as initializing the camera, taking pictures, switching between cameras, setting flash modes, starting and stopping image streams, and more.
This mixin can be used in widgets or classes where camera functionality is required, allowing for streamlined integration of camera operations in Flutter applications.
Properties
-
cameraAvailable
→ List<
CameraDescription> -
The list of available camera.
do not forget to initialized it using initializeCamera or initializeStreamingCamera
no setter
- cameraLensDirection → CameraLensDirection
-
The direction of the currently active camera (front or back).
no setter
- flashModeState ↔ FlashMode
-
The current flash mode of the camera (on, off, auto, etc.).
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- isStreamingImage → bool
-
no setter
- resolutionPreset → ResolutionPreset
-
The resolution preset used in currently active camera.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addListener(
{void onFlashModeChanged(FlashMode mode)?}) → void - Registers event listeners for camera features.
-
disposeCamera(
) → Future< void> - Disposes the active camera and resets flash mode to off.
-
initializeCamera(
{required CameraLensDirection cameraLensDirection, required void onCameraInitialized(CameraController controller), required void onCameraInitializedFailure(FeatureCameraException exception), ResolutionPreset resolutionPreset = ResolutionPreset.high, bool enableAudio = true, ImageFormatGroup? imageFormatGroup}) → Future< void> -
Initializes the camera with the specified
CameraLensDirectionand handles success or failure callbacks. -
initializeStreamingCamera(
{required CameraLensDirection cameraLensDirection, required void onCameraInitialized(CameraController controller), required void onCameraInitializedFailure(FeatureCameraException exception), ResolutionPreset resolutionPreset = ResolutionPreset.low, ImageFormatGroup? imageFormatGroup}) → Future< void> - Initializes the streaming camera, usually use for liveness detection.
-
isCameraAvailable(
CameraLensDirection cameraLensDirection) → Future< bool> -
Checks if a camera with the specified
cameraLensDirectionis available. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
resumeCamera(
{required void onCameraInitialized(CameraController controller), required void onCameraInitializedFailure(FeatureCameraException exception)}) → Future< void> -
Resumes the camera with the last-used
CameraLensDirectionand initializes it. -
setFlashMode(
FlashMode flashMode) → Future< void> -
Sets the camera's flash mode to the specified
flashMode(off, on, auto, etc.). -
startImageStream(
{required void onImageStream(CameraImage image, int sensorOrientation, DeviceOrientation deviceOrientation, CameraLensDirection cameraLensDirection)}) → Future< void> -
Starts streaming the camera image data and triggers
onImageStreamevery two seconds. -
stopImageStream(
) → Future< void> - Stops the image stream from the camera.
-
switchCamera(
CameraLensDirection cameraLensDirection) → Future< void> -
Switches the active camera to the specified
CameraLensDirection(front or rear). -
takePicture(
{bool includeExif = false}) → Future< CaptureImageModel> - Captures a picture using the active camera and returns the file. If the camera controller is not initialized, this function will throw an error
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited