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
depthStream → Stream<DepthFrame>
Depth maps from every session with setDepthOutput on.
no setteroverride
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 dispose has been called on this object.
no setterinherited
resizedStream → Stream<ResizedFrame>
GPU-resized tensors from every session with setResizer on.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
syncedStream → Stream<SyncedFrame>
Frame + depth pairs from every session with setSynchronizedOutput on.
no setteroverride

Methods

cancelRecording(int textureId) → void
Cancels the current recording and deletes the temporary file.
override
checkDisposed() → void
Throws StateError if dispose has 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 textureId in 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
focusAt(int textureId, double x, double y, int locked) → Future<int>
Focuses (and meters exposure) at the normalised point (x, y) in 0..1, (0,0) = top-left of the upright preview, and completes when the focus scan ends: 1 = focused, 0 = the scan ended without sharp focus. locked 1 keeps focus there afterwards (vision-camera's adaptiveness: 'locked'); 0 lets continuous AF resume. Throws INVALID_ARGUMENT: for a point outside 0..1 and FOCUS_UNSUPPORTED: on a fixed-focus camera.
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
getEncodedOutputStats(int textureId) → EncodedOutputStats
Counters of the encoder output (all zero / -1 when none is running).
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 dispose is 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 deviceId and 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
releaseNativeBuffer(int handle) → void
Returns a held CameraFrame.nativeBuffer to the camera. Unknown or already-released handles are ignored.
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_ERROR or 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
setCameraExtension(int textureId, String name) → Future<void>
Turns a vendor camera extension on (name = auto, face-retouch, bokeh, hdr, night) or off (empty) — Android CameraExtensionSession. While one is on, only preview and stills work. Throws EXTENSION_UNSUPPORTED: (always on iOS), SESSION_BUSY: while recording.
override
setDepthOutput(int textureId, int enabled) → Future<void>
Starts / stops the depth stream (depthStream) for the session. Android: a DEPTH16 stream on cameras with the DEPTH_OUTPUT capability (reopens the session); iOS: AVCaptureDepthDataOutput (TrueDepth / dual / LiDAR cameras). Throws DEPTH_UNSUPPORTED: when the device has no depth (CameraFormat.supportsDepthCapture). enabled: 1 = on, 0 = off.
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. value is -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: distance 0.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_ON on the activity window, iOS sets isIdleTimerDisabled. 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. Pass iso <= 0 to restore automatic exposure (and re-enable exposure-compensation bias).
override
setMultiCamEnabled(int enabled) → void
1 = cameras opened from now on run SIMULTANEOUSLY in one shared iOS AVCaptureMultiCamSession (vision-camera's requiresMultiCam); 0 = each camera gets its own session again (iOS then runs one at a time). Affects sessions opened afterwards. Android runs concurrent cameras natively, so this is a no-op there.
override
setNativeBuffers(int textureId, int enabled) → void
Attaches the native buffer to frames (CameraFrame.nativeBuffer) — vision-camera's frame.getNativeBuffer(), for handing the camera's own buffer to GPU / ML code without a copy. One buffer is held at a time, so the camera pool never starves. Throws NATIVE_BUFFER_UNSUPPORTED: below Android 9. enabled: 1 = on, 0 = off (releases a held buffer).
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 via NitraDetectors.register(...) (Kotlin/Swift) and select them here. An unknown name emits a descriptive error event.
override
setResizer(int textureId, ResizerOptions options) → Future<void>
Starts / stops / reconfigures the GPU resizer that streams ML-ready tensors of every frame on resizedStream (vision-camera-resizer).
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
setSynchronizedOutput(int textureId, int enabled) → Future<void>
Pairs each video frame with the depth map captured with it and streams the pairs on syncedStream (vision-camera's CameraOutputSynchronizer). Turns depth output on as needed; throws DEPTH_UNSUPPORTED: like setDepthOutput. enabled: 1 = on, 0 = off.
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
startEncodedOutput(int textureId, int width, int height, int bitRate) → void
Attaches a hardware H.264 encoder (MediaCodec / VideoToolbox) to the session through the native NitroCameraOutputs hook — the path an RTMP / WebRTC publisher plugin takes. Upright, un-mirrored on Android, camera timestamps; the preview keeps running (Android moves a direct preview onto the GL renderer). width/height apply on Android; iOS encodes at the session's frame size. Replaces a running encoder output.
override
startHighSpeedRecording(int textureId, String path, int fps) → Future<int>
Starts a high-frame-rate (slow-mo) recording at fps (e.g. 120 / 240) to path. 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 for fps. 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
stopEncodedOutput(int textureId) → void
Detaches and releases the encoder output. No-op when none is running.
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. overlayData is a serialized binary Buffer of draw commands.
override

Operators

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