AmolGangadhare / flutter_barcode_scanner

Barcode scanner plugin for flutter. Supports barcode scanning for Android and iOS
https://pub.dev/packages/flutter_barcode_scanner
MIT License
379 stars 454 forks source link

"Real" continuous scanning #44

Open magnus-lpa opened 4 years ago

magnus-lpa commented 4 years ago

I have a need to detect only barcodes that have been visible to the camera for a certain time.

For this use case it would be useful if we could get a mode where continuous scanning would deliver a continuous stream of events, not only one event for each barcode. What I would like is a steady flow of events, even when the camera is still seeing the same barcode. That way one could determine if a barcode has been visible for a consecutive amount of time or if it just flipped by the camera quickly.

I guess one (ugly) solution would be to use single scan mode and each time a barcode is scanned start a timer that would perform a scan after X amount of time, and if the same barcode is still visible the app would assume that it has been present between the first and second scan.

Another solution would be to have a setting in the plugin, where a barcode has to be visible to the plugin at least X amount of time to be considered a "hit", although it seems that a continuous mode that delivers a steady flow of events to the app would be more versatile.

A third option would be if the plugin implemented both a "enter" and "leave" event, so the app could determine how long the barcode was visible.

AmolGangadhare commented 4 years ago

Hi @magnus-lpa ,

Thanks for using the plugin. I guess the single event is applicable to android only as iOS will give a continuous stream of scanned barcode/QR have you tried it on iOS also? I'll try some fixes for the android part and will update you on this.