CameraController class
Controls a device camera.
Use availableCameras to get a list of available cameras.
Before using a CameraController a call to initialize must complete.
To show the camera preview on the screen use a CameraPreview widget.
- Inheritance
-
- Object
- ChangeNotifier
- ValueNotifier<
CameraValue> - CameraController
Constructors
- CameraController(CameraDescription description, ResolutionPreset resolutionPreset, {bool enableAudio = true, int? fps, int? videoBitrate, int? audioBitrate, ImageFormatGroup? imageFormatGroup})
- Creates a new camera controller in an uninitialized state.
Properties
- cameraId → int
-
The camera identifier with which the controller is associated.
no setter
- description → CameraDescription
-
The properties of the camera device controlled by this controller.
no setter
- enableAudio → bool
-
Whether to include audio when recording a video.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- imageFormatGroup → ImageFormatGroup?
-
The ImageFormatGroup describes the output of the raw image format.
final
- mediaSettings → MediaSettings
-
The media settings this controller is targeting.
final
- resolutionPreset → ResolutionPreset
-
The resolution this controller is targeting.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value ↔ CameraValue
-
The current value stored in this notifier.
getter/setter pairinherited
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
buildPreview(
) → Widget - Returns a widget showing a live camera preview.
-
debugCheckIsDisposed(
) → void - Checks whether CameraController.dispose has completed successfully.
-
dispose(
) → Future< void> -
Releases the resources of this camera.
override
-
getExposureOffsetStepSize(
) → Future< double> - Gets the supported step size for exposure offset for the selected camera in EV units.
-
getMaxExposureOffset(
) → Future< double> - Gets the maximum supported exposure offset for the selected camera in EV units.
-
getMaxZoomLevel(
) → Future< double> - Gets the maximum supported zoom level for the selected camera.
-
getMinExposureOffset(
) → Future< double> - Gets the minimum supported exposure offset for the selected camera in EV units.
-
getMinZoomLevel(
) → Future< double> - Gets the minimum supported zoom level for the selected camera.
-
initialize(
) → Future< void> - Initializes the camera on the device.
-
lockCaptureOrientation(
[DeviceOrientation? orientation]) → Future< void> - Locks the capture orientation.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
pausePreview(
) → Future< void> - Pauses the current camera preview
-
pauseVideoRecording(
) → Future< void> - Pause video recording.
-
prepareForVideoRecording(
) → Future< void> - Prepare the capture session for video recording.
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
override
-
resumePreview(
) → Future< void> - Resumes the current camera preview
-
resumeVideoRecording(
) → Future< void> - Resume video recording after pausing.
-
setDescription(
CameraDescription description) → Future< void> - Sets the description of the camera.
-
setExposureMode(
ExposureMode mode) → Future< void> - Sets the exposure mode for taking pictures.
-
setExposureOffset(
double offset) → Future< double> - Sets the exposure offset for the selected camera.
-
setExposurePoint(
Offset? point) → Future< void> - Sets the exposure point for automatically determining the exposure value.
-
setFlashMode(
FlashMode mode) → Future< void> - Sets the flash mode for taking pictures.
-
setFocusMode(
FocusMode mode) → Future< void> - Sets the focus mode for taking pictures.
-
setFocusPoint(
Offset? point) → Future< void> - Sets the focus point for automatically determining the focus value.
-
setZoomLevel(
double zoom) → Future< void> - Set the zoom level for the selected camera.
-
startImageStream(
onLatestImageAvailable onAvailable) → Future< void> - Start streaming images from platform camera.
-
startVideoRecording(
{onLatestImageAvailable? onAvailable}) → Future< void> - Start a video recording.
-
stopImageStream(
) → Future< void> - Stop streaming images from platform camera.
-
stopVideoRecording(
) → Future< XFile> - Stops the video recording and returns the file where it was saved.
-
takePicture(
) → Future< XFile> - Captures an image and returns the file where it was saved.
-
toString(
) → String -
A string representation of this object.
inherited
-
unlockCaptureOrientation(
) → Future< void> - Unlocks the capture orientation.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- kUninitializedCameraId → const int
- The id of a camera that hasn't been initialized.