flutter_native_vision_camera 0.1.0
flutter_native_vision_camera: ^0.1.0 copied to clipboard
High-performance Flutter FFI camera plugin with zero-copy preview textures, integrated MLKit/Vision barcode scanning, and low-latency native frame access for real-time on-device vision.
Changelog #
0.1.0 #
- Off-isolate frame worklets — the headline feature.
CameraController.setFrameWorklet(entry, args:)runs heavy per-frame work (ML inference, CV) on a background isolate, with the main thread untouched; results stream back viaCameraController.frameResults. The worklet entry is a top-level function (Dart can't ship closures across isolates) and receives aFrameWorkletcontext (onFrame,send,args). Frames cross to the worker as the same zero-copy FFI pointers. The simpler main-isolatesetFrameProcessorstays for light work. - Example: the Object Detector now runs entirely off-isolate — EfficientDet-Lite0 inference on a worker, with a live main-isolate UI-tick counter proving the main thread stays free.
- Internal: shared
Frame.fromNativefactory; race-free cross-isolate worklet teardown.
0.0.6 #
- New:
CameraController.previewRectFromFrame(rect, sourceRotationDegrees:)maps a normalized detection box from a frame's coordinate space into preview-display space, accounting for the live preview rotation and the front-camera mirror — so ML overlays line up with the preview at any device orientation (the preview rotation and frame orientation are tracked independently, so boxes drawn without it drift as the phone turns). - Example: added a real-time Object Detector page — the FFI frame pipeline drives an on-device
EfficientDet-Lite0 detector (90 COCO classes) in a background isolate, with labelled boxes and a
cat-certainty voting trigger. Demonstrates YUV→RGB preprocessing, isolate inference, and
previewRectFromFramefor correctly-oriented overlays.
0.0.5 #
- Docs: added demo GIFs to the README (live preview + orientation, barcode/QR scanning with overlay, and the FFI frame processor's live brightness read). The GIFs live in the repo and are referenced by raw URL, so they're excluded from the published package.
0.0.4 #
Correctness, honesty, and packaging pass.
- Fixed: removed the deprecated
packageattribute from the Android manifest (broke builds under AGP 8.x; the namespace is set inbuild.gradle). - Fixed: Android video recording no longer crashes —
RECORD_AUDIOis now declared and audio is gated behind a runtime permission check, falling back to video-only when the mic is unavailable. - Fixed:
requestMicrophonePermissionnow actually awaits the permission dialog result. - Fixed: frame processor no longer routes frames through a no-op relay isolate. The Dart callback is now
delivered directly via
NativeCallable.listener; documentation corrected to state it runs on the main isolate event loop (not a background isolate). - Fixed:
CameraPreviewnow rebuilds when the controller updates (e.g. after async init or device switch). - Fixed: Android tap-to-focus now targets the correct metering point.
- Improved: Android frames now expose all YUV planes with correct row strides (previously only the Y plane).
- Improved: iOS reports the real frame pixel format and retains preview buffers safely.
- Packaging: real podspec metadata, version lockstep, honest README/feature matrix,
topics/issue_tracker, CI (format/analyze/test/dry-run/pana + per-platform native builds), dropped the unusedplugin_platform_interfacedependency. - iOS: implemented video recording (AVAssetWriter, keeps the frame stream live),
setFocusDistance, barcode symbology filtering, teardown-on-reinit,CVPixelBufferretain/lock balance, honest pixel format, main-thread results. Device-verified on iOS 18 (preview, photo, video, scanning). - Orientation (structural): preview rotation is now read from the camera framework
(Android
SurfaceRequest.TransformationInfo, iOS sensor-relative) and applied once inCameraPreview— fixing the recurring 90° tilt. Addedcontroller.previewRotation/displayPreviewSize; scanner overlay and camera page no longer compensate for rotation themselves. iOS Vision boxes now use the buffer orientation. - Mirroring: a single
mirrorflag oninitializedrives both the front-camera preview and the saved photo/video; the preview no longer double-mirrors on Android.CameraPreviewgainsResizeMode.contain. - Android: dynamic capture orientation, correct tap-to-focus metering, real photo orientation.
- API: exposed per-plane strides (
Frame.planeBytesPerRow/planePixelStride) so chroma planes can be walked correctly; addedCameraDevices.getCameraFormat(...)to pick a format by resolution/fps. - Docs: comprehensive README (compile-correct quickstart with permissions, photo/video/scan/lifecycle
snippets, a correct native C/C++ plugin guide, requirements, expanded platform matrix, Limitations & Roadmap);
rewrote the example README; corrected the "background isolate" claim in the API docs to match reality
(main isolate); documented
takeSnapshot(iOS-only),setExposureunits, andinitialize'spixelFormat/mirror. - Example: the Native Vision Camera page now reads the raw frame buffer over FFI and shows a live average brightness, demonstrating the headline feature; fixed the C++ sample's row-stride indexing.
0.0.3 #
- Migrated the Android embedding to AndroidX for better compatibility.
0.0.2 #
- Fixed pubspec metadata (homepage, repository).
0.0.1 #
- Initial release of
flutter_native_vision_camera. - FFI pipeline for frame access, zero-copy preview textures, basic camera controls (zoom, focus, flash), and real-time barcode scanning.