CameraPlatform class abstract

The interface that implementations of camera must implement.

Platform implementations should extend this class rather than implement it as camera does not consider newly added methods to be breaking changes. Extending this class (using extends) ensures that the subclass will get the default implementation, while platform implementations that implements this interface will be broken by newly added CameraPlatform methods.

Inheritance
  • Object
  • PlatformInterface
  • CameraPlatform

Constructors

CameraPlatform()
Constructs a CameraPlatform.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

availableCameras() Future<List<CameraDescription>>
Completes with a list of available cameras.
buildPreview(int cameraId) Widget
Returns a widget showing a live camera preview.
createCamera(CameraDescription cameraDescription, ResolutionPreset? resolutionPreset, {bool enableAudio = false}) Future<int>
Creates an uninitialized camera instance and returns the cameraId.
createCameraWithSettings(CameraDescription cameraDescription, MediaSettings mediaSettings) Future<int>
Creates an uninitialized camera instance and returns the cameraId.
dispose(int cameraId) Future<void>
Releases the resources of this camera.
getExposureOffsetStepSize(int cameraId) Future<double>
Gets the supported step size for exposure offset for the selected camera in EV units.
getMaxExposureOffset(int cameraId) Future<double>
Gets the maximum supported exposure offset for the selected camera in EV units.
getMaxZoomLevel(int cameraId) Future<double>
Gets the maximum supported zoom level for the selected camera.
getMinExposureOffset(int cameraId) Future<double>
Gets the minimum supported exposure offset for the selected camera in EV units.
getMinZoomLevel(int cameraId) Future<double>
Gets the minimum supported zoom level for the selected camera.
initializeCamera(int cameraId, {ImageFormatGroup imageFormatGroup = ImageFormatGroup.unknown}) Future<void>
Initializes the camera on the device.
lockCaptureOrientation(int cameraId, DeviceOrientation orientation) Future<void>
Locks the capture orientation.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onCameraClosing(int cameraId) Stream<CameraClosingEvent>
The camera started to close.
onCameraError(int cameraId) Stream<CameraErrorEvent>
The camera experienced an error.
onCameraInitialized(int cameraId) Stream<CameraInitializedEvent>
The camera has been initialized.
onCameraResolutionChanged(int cameraId) Stream<CameraResolutionChangedEvent>
The camera's resolution has changed. On Web this returns an empty stream.
onDeviceOrientationChanged() Stream<DeviceOrientationChangedEvent>
The ui orientation changed.
onStreamedFrameAvailable(int cameraId, {CameraImageStreamOptions? options}) Stream<CameraImageData>
A new streamed frame is available.
onVideoRecordedEvent(int cameraId) Stream<VideoRecordedEvent>
The camera finished recording a video.
pausePreview(int cameraId) Future<void>
Pause the active preview on the current frame for the selected camera.
pauseVideoRecording(int cameraId) Future<void>
Pause video recording.
prepareForVideoRecording() Future<void>
Prepare the capture session for video recording.
resumePreview(int cameraId) Future<void>
Resume the paused preview for the selected camera.
resumeVideoRecording(int cameraId) Future<void>
Resume video recording after pausing.
setDescriptionWhileRecording(CameraDescription description) Future<void>
Sets the active camera while recording.
setExposureMode(int cameraId, ExposureMode mode) Future<void>
Sets the exposure mode for taking pictures.
setExposureOffset(int cameraId, double offset) Future<double>
Sets the exposure offset for the selected camera.
setExposurePoint(int cameraId, Point<double>? point) Future<void>
Sets the exposure point for automatically determining the exposure values.
setFlashMode(int cameraId, FlashMode mode) Future<void>
Sets the flash mode for the selected camera. On Web FlashMode.auto corresponds to FlashMode.always.
setFocusMode(int cameraId, FocusMode mode) Future<void>
Sets the focus mode for taking pictures.
setFocusPoint(int cameraId, Point<double>? point) Future<void>
Sets the focus point for automatically determining the focus values.
setImageFileFormat(int cameraId, ImageFileFormat format) Future<void>
Sets the output image file format for the selected camera.
setZoomLevel(int cameraId, double zoom) Future<void>
Set the zoom level for the selected camera.
startVideoCapturing(VideoCaptureOptions options) Future<void>
Starts a video recording and/or streaming session.
startVideoRecording(int cameraId, {Duration? maxVideoDuration}) Future<void>
Starts a video recording.
stopVideoRecording(int cameraId) Future<XFile>
Stops the video recording and returns the file where it was saved.
takePicture(int cameraId) Future<XFile>
Captures an image and returns the file where it was saved.
toString() String
A string representation of this object.
inherited
unlockCaptureOrientation(int cameraId) Future<void>
Unlocks the capture orientation.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

instance CameraPlatform
The default instance of CameraPlatform to use.
getter/setter pair