Rqmco
Committed by GitHub

Fix: Fixes Issue #531

@@ -116,6 +116,10 @@ class _MobileScannerState extends State<MobileScanner> @@ -116,6 +116,10 @@ class _MobileScannerState extends State<MobileScanner>
116 await Future.delayed(const Duration(seconds: 1, milliseconds: 500)); 116 await Future.delayed(const Duration(seconds: 1, milliseconds: 500));
117 } 117 }
118 118
  119 + _barcodesSubscription ??= _controller.barcodes.listen(
  120 + widget.onDetect,
  121 + );
  122 +
119 if (!_controller.autoStart) { 123 if (!_controller.autoStart) {
120 debugPrint( 124 debugPrint(
121 'mobile_scanner: not starting automatically because autoStart is set to false in the controller.', 125 'mobile_scanner: not starting automatically because autoStart is set to false in the controller.',
@@ -123,10 +127,6 @@ class _MobileScannerState extends State<MobileScanner> @@ -123,10 +127,6 @@ class _MobileScannerState extends State<MobileScanner>
123 return; 127 return;
124 } 128 }
125 129
126 - _barcodesSubscription ??= _controller.barcodes.listen(  
127 - widget.onDetect,  
128 - );  
129 -  
130 _controller.start().then((arguments) { 130 _controller.start().then((arguments) {
131 // ignore: deprecated_member_use_from_same_package 131 // ignore: deprecated_member_use_from_same_package
132 widget.onStart?.call(arguments); 132 widget.onStart?.call(arguments);