juliansteenbakker / mobile_scanner

A universal scanner for Flutter based on MLKit. Uses CameraX on Android and AVFoundation on iOS.
BSD 3-Clause "New" or "Revised" License
868 stars 508 forks source link

detects there's no barcode #1211

Open jameschristianw opened 1 week ago

jameschristianw commented 1 week ago

ondetect runs when there's a barcode. how to tell if there's no barcode?

navaronbracke commented 1 week ago

We could make onDetect return a nullable BarcodeCapture. The barcodes stream does also not report events when an image frame has no barcode I think. (because that would be expensive, you'd have to send events every frame)

I'm curious about your use case, though? How would you handle this with a continuous stream of images frames that all might not contain barcodes?

jameschristianw commented 4 days ago

i agree that would be expensive. to be fair, i still don't know how to handle the continuous stream of image so what i'm doing right now is save detected barcode to a temp variable, pausing subscription, do something with the barcode, remove the detecte barcode from temp variable, resume subs

i have a suggestion, i don't know if this is feasible or not, can you add new function to controller to detect current frame

navaronbracke commented 4 days ago

Pausing the subscription when a barcode is received is the correct way to handle things here.

What do you mean with "detect current frame" ? The scanner continuously uses the frames as they come in for detection, so I do not see how that is different from "detect the current frame" ?