NitroCameraDefaults mixin
Default throw UnimplementedError bodies for every member of NitroCamera, so
hand-written fakes keep compiling when the spec grows:
class FakeNitroCamera extends NitroCamera with NitroCameraDefaults { /* overrides */ }.
- Superclass constraints
- Available extensions
Properties
- asAnyNativeObject → AnyNativeObject
-
Available on NitroCamera, provided by the NitroCameraNativeRef extension
no setter -
eventStream
→ Stream<
CameraEvent> -
Stream of session lifecycle / error / interruption events across all open
camera sessions. Buffered (oldest dropped) so events are never lost to a
briefly-slow listener.
no setteroverride
-
frameStream
→ Stream<
CameraFrame> -
Stream of raw camera frames for custom image processing pipelines.
Only active for sessions where enableFrameProcessing was called with 1.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- isDisposed → bool
-
Whether
disposehas been called on this object.no setterinherited - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
cancelRecording(
int textureId) → void -
Cancels the current recording and deletes the temporary file.
override
-
checkDisposed(
) → void -
Throws StateError if
disposehas already been called. Called automatically at the start of every generated method and getter.inherited -
closeCamera(
int textureId) → Future< void> -
override
-
configure(
int textureId, CameraConfig config) → Future< ResolvedConfig> -
Applies a batch of live settings to the open session
textureIdin one pass and returns what was actually applied. The declarative analogue of the individual setters above — does NOT reopen the session (device/format/fps changes must go through openCamera).override -
dispose(
) → void -
Releases all native resources held by this object.
inherited
-
enableDeviceAvailabilityEvents(
int enabled) → void -
Starts emitting CameraEventType.deviceConnected /
CameraEventType.deviceDisconnected hot-plug events (e.g. USB cameras).
enabled: 1 = on, 0 = off.override -
enableFrameProcessing(
int textureId, int enabled) → void -
Enables or disables raw frame delivery to frameStream.
enabled: 1 = on, 0 = off.override -
enableOrientationEvents(
int enabled) → void -
Starts emitting CameraEventType.orientationChanged events for physical
device rotation (via the native orientation sensor listener — works even
when the UI orientation is locked).
enabled: 1 = on, 0 = off.override -
getAvailableCameraDevices(
) → List< CameraDevice> -
Returns a list of all available camera devices.
override
-
getAvailableCameraDevicesJson(
) → Future< String> -
override
-
getCameraPermissionStatus(
) → int -
Returns the current camera permission status without prompting.
override
-
getConcurrentCameraIdsJson(
) → String -
Returns the camera-ID combinations that can stream CONCURRENTLY
(multi-cam), as a JSON array of arrays (e.g.
[["0","1"]]). Empty when unsupported (API < 30 or no combinations).override -
getDevice(
int index) → CameraDevice -
override
-
getDeviceCount(
) → int -
override
-
getMicrophonePermissionStatus(
) → int -
Returns the current microphone permission status without prompting.
override
-
getPreviewTransform(
int textureId) → PreviewTransform -
How to frame the Texture right now (see PreviewTransform). Changes on
device rotation (CameraEventType.orientationChanged) and when the
session switches direct <-> GL (CameraEventType.previewTransformChanged).
override
-
getSessionStateJson(
int textureId) → String -
Returns the live session state (running, fps, resolution, pixelFormat) as a
JSON object. Useful for diagnostics and UI read-back.
override
-
lockExposure(
int textureId, int locked) → void -
Locks or unlocks auto-exposure at its current value.
locked: 1 = locked.override -
lockFocus(
int textureId, int locked) → void -
Locks or unlocks focus at its current position.
locked: 1 = locked.override -
lockWhiteBalance(
int textureId, int locked) → void -
Locks or unlocks white balance at its current gains.
locked: 1 = locked.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onDestroy(
) → void -
Called once when
disposeis first invoked. Override to perform cleanup (close file handles, cancel work, etc.).inherited -
onMemoryTrim(
) → void -
Android low-memory signal. Override to release caches or non-critical data.
inherited
-
openCamera(
String deviceId, int width, int height, int fps, int enableAudio, int frameWidth, int frameHeight, int enablePhoto, int directPreview) → Future< int> -
Opens the camera identified by
deviceIdand starts streaming frames into a Flutter Texture. Returns the Flutter texture ID.override -
pauseRecording(
int textureId) → void -
Pauses an active video recording without finalising the file.
override
-
requestCameraPermission(
) → Future< int> -
Requests camera permission from the OS.
Returns a PermissionStatus value.
override
-
requestMicrophonePermission(
) → Future< int> -
Requests microphone permission from the OS.
Returns a PermissionStatus value.
override
-
reset(
) → void -
Resets the native camera metadata caches and releases overall hardware locks.
Call this to recover from serious
CAMERA_ERRORor when hardware configuration changes (e.g. plugging in a USB camera).override -
resumeRecording(
int textureId) → void -
Resumes a paused video recording.
override
-
setAutoFocus(
int textureId, int mode) → void -
Sets the auto-focus mode. Pass an AutoFocusMode value.
override
-
setDistortionCorrection(
int textureId, int enabled) → void -
Enables or disables lens distortion correction on the capture pipeline
(Camera2
DISTORTION_CORRECTION_MODE, API 28+). No-op when the device doesn't support it.enabled: 1 = on (HIGH_QUALITY), 0 = off.override -
setExposure(
int textureId, double value) → void -
Sets exposure compensation.
valueis -1.0 (darkest) to 1.0 (brightest).override -
setFilterShader(
int textureId, String shaderSource) → void -
Updates the GPU-accelerated filter shader on the camera preview.
Pass a valid GLSL Fragment Shader source.
The shader should expect:
override
-
setFlash(
int textureId, int mode) → void -
Sets the flash mode for photo capture. Pass a FlashMode value.
override
-
setFocusDistance(
int textureId, double distance) → void -
Manual focus distance:
distance0.0 (far / infinity) → 1.0 (nearest), or a negative value to restore continuous auto-focus. Fixed-focus lenses and devices without custom-lens-position support ignore it.override -
setFocusPoint(
int textureId, double x, double y) → void -
Locks focus at the normalised point (
x,y) where (0,0) is top-left.override -
setFrameFormat(
int textureId, int format) → void -
Sets the pixel format for the frameStream.
format: 0 = YUV_420_888 (Planar), 1 = BGRA_8888 (Interleaved RGB).override -
setHdr(
int textureId, int enabled) → void -
Enables or disables HDR capture.
enabled: 1 = on.override -
setKeepScreenOn(
int enabled) → void -
Keeps the screen awake while the camera UI is up — Android sets
FLAG_KEEP_SCREEN_ONon the activity window, iOS setsisIdleTimerDisabled.enabled: 1 = on, 0 = off. (An FFI spec method, so no extra plugin / method channel is needed.)override -
setLowLightBoost(
int textureId, int enabled) → void -
Enables or disables low-light boost (night mode).
enabled: 1 = on.override -
setManualExposure(
int textureId, double iso, double exposureNanos) → void -
Manual exposure: fixes ISO (
iso, e.g. 100..3200) and shutter time (exposureNanos, in nanoseconds, e.g. 1/50s = 20_000_000). Both are clamped to the device's supported range. Passiso<= 0 to restore automatic exposure (and re-enable exposure-compensation bias).override -
setNativeDetector(
int textureId, String detector) → void -
Runs a NATIVE detector on the session's frames, emitting
CameraEventType.detection events with a JSON payload per hit.
detector: a registered detector name, or "" to stop. The built-ins are "barcode" / "face" (ML Kit on Android — the host app adds the artifact; the built-in Vision framework on iOS). Host apps register their own native detector plugins by name viaNitraDetectors.register(...)(Kotlin/Swift) and select them here. An unknown name emits a descriptive error event.override -
setSamplingRate(
int textureId, int samplingRate) → void -
Configures how many frames to skip before delivering to frameStream.
samplingRate: 1 = every frame, 2 = every 2nd frame, etc.override -
setTargetOrientation(
int textureId, int degrees) → void -
Sets the target output orientation in degrees (0 / 90 / 180 / 270).
override
-
setTorch(
int textureId, int enabled) → void -
Enables or disables the torch (continuous flashlight).
enabled: 1 = on.override -
setTorchLevel(
int textureId, double level) → void -
Sets the torch brightness in 0.0..1.0 (1.0 = max). Values > 0 imply torch on.
override
-
setVideoStabilization(
int textureId, int mode) → void -
Sets the video stabilization mode. Pass a VideoStabilizationMode value.
override
-
setWhiteBalance(
int textureId, int temperature) → void -
Sets the white-balance colour temperature in Kelvin.
Pass 0 to restore automatic white balance.
override
-
setZoom(
int textureId, double zoom) → void -
Sets the zoom level. Must be within CameraDevice.minZoom .. CameraDevice.maxZoom.
override
-
startHighSpeedRecording(
int textureId, String path, int fps) → Future< int> -
Starts a high-frame-rate (slow-mo) recording at
fps(e.g. 120 / 240) topath. Uses a dedicated high-speed capture session (Android) / high-fps format (iOS), separate from the normal preview session. Returns 1 on success, 0 when the device advertises no high-speed config forfps. Photo capture and frame processing are unavailable while active.override -
startPreview(
int textureId) → void -
Resumes the camera preview after stopPreview.
override
-
startVideoRecording(
int textureId, String outputPath, RecordingOptions options) → Future< void> -
override
-
stopHighSpeedRecording(
int textureId) → Future< RecordingResult> -
Stops a high-speed recording started with startHighSpeedRecording and
restores the normal preview session. Returns the recorded file metadata.
override
-
stopPreview(
int textureId) → void -
Pauses the camera preview without closing the session.
override
-
stopVideoRecording(
int textureId) → Future< RecordingResult> -
override
-
takePhoto(
int textureId) → Future< PhotoResult> -
override
-
takePhotoWithOptions(
int textureId, PhotoOptions options) → Future< PhotoResult> -
Captures a photo using explicit
options(flash, quality, shutter sound).override -
takeSnapshot(
int textureId) → Future< PhotoResult> -
Captures the current preview frame as a fast JPEG snapshot (no full
still-capture round-trip).
override
-
toString(
) → String -
A string representation of this object.
inherited
-
updateOverlay(
int textureId, Uint8List overlayData) → void -
Draws a persistent shape or text vector onto the camera overlay.
Renders directly on the GPU using the custom pipeline.
overlayDatais a serialized binary Buffer of draw commands.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited