Navaron Bracke

clear barocdes on the web before restarting; forward barcode stream on web

@@ -41,6 +41,9 @@ class MobileScannerWeb extends MobileScannerPlatform { @@ -41,6 +41,9 @@ class MobileScannerWeb extends MobileScannerPlatform {
41 } 41 }
42 42
43 @override 43 @override
  44 + Stream<BarcodeCapture?> get barcodesStream => _barcodesController.stream;
  45 +
  46 + @override
44 Widget buildCameraView() { 47 Widget buildCameraView() {
45 if (!_barcodeReader.isScanning) { 48 if (!_barcodeReader.isScanning) {
46 throw const MobileScannerException( 49 throw const MobileScannerException(
@@ -80,6 +83,9 @@ class MobileScannerWeb extends MobileScannerPlatform { @@ -80,6 +83,9 @@ class MobileScannerWeb extends MobileScannerPlatform {
80 } 83 }
81 84
82 try { 85 try {
  86 + // Clear the existing barcodes.
  87 + _barcodesController.add(const BarcodeCapture());
  88 +
83 await _barcodeReader.start( 89 await _barcodeReader.start(
84 startOptions, 90 startOptions,
85 containerElement: _divElement!, 91 containerElement: _divElement!,
@@ -145,9 +151,6 @@ class MobileScannerWeb extends MobileScannerPlatform { @@ -145,9 +151,6 @@ class MobileScannerWeb extends MobileScannerPlatform {
145 _barcodesSubscription?.cancel(); 151 _barcodesSubscription?.cancel();
146 _barcodesSubscription = null; 152 _barcodesSubscription = null;
147 153
148 - // Clear the existing barcodes.  
149 - _barcodesController.add(const BarcodeCapture());  
150 -  
151 await _barcodeReader.stop(); 154 await _barcodeReader.stop();
152 } 155 }
153 156