UCameraController class

Drives one native camera session. Create it, initialize it, hand UCameraValue.textureId to a Texture widget, and dispose it when done.

Inheritance

Constructors

UCameraController({UCameraConfig config = const UCameraConfig()})

Properties

codes → Stream<List<UCode>>
Barcodes, when scanning is on.
no setter
config → UCameraConfig
no setter
errors → Stream<UCameraException>
no setter
frames → Stream<UCameraFrame>
Analysis frames, when UCameraConfig.imageStream is on.
no setter
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
isDisposed → bool
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sessionId → int?
no setter
singleCodes → Stream<UCode>
Codes flattened to one event per new symbol, already de-duplicated.
no setter
textureId → int?
no setter
value ↔ UCameraValue
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
dispose() → Future<void>
Discards any resources used by the object.
override
enterPictureInPicture() → Future<void>
focusAndMeterAt(Offset point) → Future<void>
Focus and meter at the same normalized point, the usual tap-to-focus.
initialize() → Future<void>
lockCaptureOrientation([UCameraOrientation? orientation]) → Future<void>
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>
pauseVideoRecording() → Future<void>
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
resetScanHistory() → void
Clears the de-duplication window so the same code fires again.
resume() → Future<void>
resumePreview() → Future<void>
resumeVideoRecording() → Future<void>
setExposureDuration(Duration duration) → Future<void>
setExposureMode(UExposureMode mode) → Future<void>
setExposureOffset(double offset) → Future<void>
setExposurePoint(Offset? point) → Future<void>
point is normalized to the preview: (0,0) top-left, (1,1) bottom-right.
setFlashMode(UFlashMode mode) → Future<void>
setFocusDistance(double distance) → Future<void>
setFocusMode(UFocusMode mode) → Future<void>
setFocusPoint(Offset? point) → Future<void>
setHdr(UHdrMode mode) → Future<void>
setIso(double iso) → Future<void>
setLens(UCameraLens lens) → Future<void>
Switches the active physical lens of a logical multi-camera device.
setNightMode(UNightMode mode) → Future<void>
setScanRegion(Rect? normalizedRegion) → void
Restricts decoding to a rectangle of the preview, in normalized coordinates. Cutting the search area is the cheapest speed win there is.
setStabilization(UStabilizationMode mode) → Future<void>
setTorch(bool on) → Future<void>
setWhiteBalance(UWhiteBalanceMode mode, {double? temperature}) → Future<void>
setZoom(double zoom) → Future<void>
startImageStream({UFrameFormat? format, double? maxFps, int? downscale}) → Future<void>
startScanning({UCodeScanOptions? options, UScanEngine? engine}) → Future<void>
startVideoRecording({String? path, UVideoCodec? codec, int? bitrate, bool? enableAudio, Duration? maxDuration}) → Future<bool>
stopImageStream() → Future<void>
stopScanning() → Future<void>
stopVideoRecording() → Future<UCapturedVideo?>
suspend() → Future<void>
Releases the native session but keeps this controller usable; call initialize again to reopen. Used when the app goes to the background.
switchCamera() → Future<void>
Flips between the first back and front cameras.
switchToDevice(String deviceId) → Future<void>
Rebuilds the session on another device. Recording is stopped first.
takePhoto({String? path, UPhotoFormat? format, int? quality, bool? mirror, bool includeBytes = true, bool includeThumbnail = false, UCameraSize? maxSize}) → Future<UCapturedPhoto?>
takeSnapshot({UPhotoFormat format = UPhotoFormat.jpeg, int quality = 90}) → Future<UCapturedPhoto?>
Grabs the current preview frame as an image without a full capture cycle. Much faster than takePhoto and silent, at preview resolution.
toggleTorch() → Future<void>
toString() → String
A string representation of this object.
inherited
unlockCaptureOrientation() → Future<void>

Operators

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

Static Methods

analyzeImage({String? path, Uint8List? bytes, UCodeScanOptions options = const UCodeScanOptions(multiple: true), UScanEngine engine = UScanEngine.auto}) → Future<List<UCode>>
Decodes an image file or byte buffer without opening a camera.
availableCameras() → Future<List<UCameraDevice>>
decodeToGray(Uint8List bytes) → Future<UGrayImage?>
Turns encoded image bytes (JPEG, PNG, WebP, ...) into a grayscale buffer using Flutter's own codecs.
isSupported() → Future<bool>
openSettings() → Future<bool>
Opens the OS settings page so the user can grant a permanently denied permission. Returns false where the platform has no such screen.
permissionStatus() → Future<UCameraPermissionState>
requestPermission({bool audio = false}) → Future<UCameraPermissionState>