Julian Steenbakker
Committed by GitHub

Merge pull request #1400 from juliansteenbakker/hotfix/on-detect

fix: fix on detect not working when controller is provided
... ... @@ -278,12 +278,16 @@ class _MobileScannerState extends State<MobileScanner>
if (widget.controller == null) {
WidgetsBinding.instance.addObserver(this);
}
if (widget.onDetect != null) {
_subscription = controller.barcodes.listen(
widget.onDetect,
onError: widget.onDetectError,
cancelOnError: false,
);
}
if (controller.autoStart) {
await controller.start();
}
... ...