XCameraValue class

Immutable snapshot of a XCameraController's state, broadcast to listeners. Updated on lifecycle transitions and on device- orientation events from the native side.

Constructors

XCameraValue({required XCameraDescription description, Size? previewSize, bool isInitialized = false, bool isRecordingVideo = false, DeviceOrientation deviceOrientation = DeviceOrientation.portraitUp, bool enableAudio = false, bool audioPermissionGranted = false, int previewRotationQuarterTurns = 0, String? errorDescription})
Binds a full state snapshot; every field but description defaults to the uninitialized value.
const
XCameraValue.uninitialized(XCameraDescription d)
State of a camera bound but not yet initialized.
factory

Properties

audioPermissionGranted → bool
True iff the user has granted microphone access. Updated when the controller initialises and on XCameraController.refreshAudioPermission. Independent of enableAudio — a controller can request audio (enableAudio: true) without having permission, in which case recordings have no audio track and callers should surface a hint.
final
description → XCameraDescription
The camera this state describes.
final
deviceOrientation → DeviceOrientation
Physical orientation reported by the native side's orientation listener. Independent of any UI lock; used by _Rotating widgets in camera_page.dart so icons flip while the preview stays portrait.
final
enableAudio → bool
Whether the session was asked to capture audio alongside video.
final
errorDescription → String?
Set to the last native session error's message when one fires. Cleared on the next successful state transition.
final
hasError → bool
Whether errorDescription is set.
no setter
hashCode → int
The hash code for this object.
no setterinherited
isInitialized → bool
Whether the native session is configured and streaming preview frames.
final
isRecordingVideo → bool
Whether a video recording is in flight.
final
previewRotationQuarterTurns → int
Number of 90° clockwise rotations the preview Texture needs so the sensor frames display upright. On iOS the data output pre-rotates via AVCaptureConnection.videoOrientation and this is always 0. On Android CameraX delivers sensor-native frames to the Surface and the consumer rotates — typically 1 for sensorOrientation: 90 back cams and 3 for sensorOrientation: 270 front cams. Applied inside XCameraPreview; consumers don't read this directly.
final
previewSize → Size?
Pixel dimensions of the active video format, in the camera sensor's natural orientation (so for typical phone sensors this is landscape — 1920×1080 etc.). Null until isInitialized.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

copyWith({XCameraDescription? description, Size? previewSize, bool? isInitialized, bool? isRecordingVideo, DeviceOrientation? deviceOrientation, bool? enableAudio, bool? audioPermissionGranted, int? previewRotationQuarterTurns, Object? errorDescription = _unset}) → XCameraValue
This snapshot with the given fields replaced. Passing errorDescription: null clears the error; omitting it keeps the current one.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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