-
-
Notifications
You must be signed in to change notification settings - Fork 525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
detects there's no barcode #1211
Comments
We could make 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? |
i agree that would be expensive. 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 |
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" ? |
The thing is that you may want to do continuous detection To do that i use a workaround by adding an empty capture on timeout. Stream<T> addTimeoutEvent<T>(
Stream<T> stream, Duration timeout, T timeoutEvent) {
final StreamController<T> controller = StreamController<T>();
Timer? timer;
void resetTimer() {
timer?.cancel();
timer = Timer(timeout, () {
controller.add(timeoutEvent);
resetTimer();
});
}
stream.listen(
(T event) {
resetTimer();
controller.add(event);
},
onError: controller.addError,
onDone: controller.close,
);
return controller.stream;
} |
I think we will need to expose this in the plugin itself, as we now have an extra use-case: In the upcoming version 7.0.0 of the plugin, we provided a widget that draws the barcode shapes on the screen. |
ondetect runs when there's a barcode. how to tell if there's no barcode?
The text was updated successfully, but these errors were encountered: