Repository navigation
Description
Use case
Hi team,
We have use cases in our app that require camera preview frames to be saved instantly, with minimal delay, for the following scenarios:
- Zero Shutter Lag (instant snapshot as soon as user taps the shutter)
- Photo booth/burst mode (multiple images in quick succession)
- Realtime AI processing (e.g. face/object detection, OCR, etc.)
Currently, the camera plugin's takePicture() method performs a full photo capture sequence (autofocus, high-res processing, etc), which always adds >1s delay—making it unsuitable for real-time or instant-capture workflows.
Developers are forced to use controller.startImageStream(), then extract/convert raw frame data (YUV420/BGRA8888) into a file/JPEG themselves in Dart. This leads to:
- Heavy CPU/memory use and UI jank (Dart processing is slow even with Isolates)
- Complicated platform-specific code
- Lower reliability compared to native burst/instant-capture support
Proposal
Expose a new API on CameraController, implemented natively, that allows instant snapshot of the current camera preview frame with low latency and zero shutter lag. Example:
/// Captures a JPEG/PNG file from the current preview frame instantly (at preview resolution, not full photo res).
Future<XFile> takePreviewSnapshot();Details:
- The method should convert the current preview buffer to a file in platform code (Kotlin/Swift/C++) for maximum speed and minimal CPU impact on Flutter UI thread.
- Returns the file via
XFilein Dart. - Should be safe to call even while preview is running (recommended for instant, burst, or AI workflow use).
This would:
- Enable true instant-capture and photo booth experiences
- Make burst shooting and low-latency AI workflows feasible without complex Dart-side buffer conversion
- Unlock competitive camera features in Flutter apps
No current workaround (using Dart/Isolates) matches the performance or reliability of native buffer-to-file logic.
We believe this feature is essential for building modern camera UX in Flutter, and would greatly appreciate your consideration.
Thank you!
Activity
darshankawar commentedon Nov 25, 2025
@leetuanbmt Can you check if your case is similar to #176148 or not ?
leetuanbmt commentedon Nov 26, 2025
@darshankawar
Thank you for asking. After reviewing #176148, our use case (#179064) is different, though both relate to camera performance.
Differences:
Problem scope:
startImageStream())Solution approach:
framesPerSecond) toCameraImageStreamOptionsto set the desired stream FPStakePreviewSnapshot()) that performs native buffer-to-file conversion for instant captureUse cases:
Why they're complementary, not similar:
They can work together: you could use
framesPerSecondto optimize the stream, then calltakePreviewSnapshot()to capture a frame from that stream. However, they solve different problems:Conclusion:
These are separate features that address different needs. Both would be valuable for building modern camera experiences in Flutter, but they are not duplicates.
Thank you for considering both features.