Navaron Bracke

do not dispose global controller on web

@@ -353,10 +353,6 @@ class MobileScannerWeb extends MobileScannerPlatform { @@ -353,10 +353,6 @@ class MobileScannerWeb extends MobileScannerPlatform {
353 353
354 @override 354 @override
355 Future<void> stop() async { 355 Future<void> stop() async {
356 - if (_barcodesController.isClosed) {  
357 - return;  
358 - }  
359 -  
360 // Ensure the barcode scanner is stopped, by cancelling the subscription. 356 // Ensure the barcode scanner is stopped, by cancelling the subscription.
361 await _barcodesSubscription?.cancel(); 357 await _barcodesSubscription?.cancel();
362 _barcodesSubscription = null; 358 _barcodesSubscription = null;
@@ -374,12 +370,8 @@ class MobileScannerWeb extends MobileScannerPlatform { @@ -374,12 +370,8 @@ class MobileScannerWeb extends MobileScannerPlatform {
374 370
375 @override 371 @override
376 Future<void> dispose() async { 372 Future<void> dispose() async {
377 - if (_barcodesController.isClosed) {  
378 - return;  
379 - }  
380 - 373 + // The `_barcodesController` and `_settingsController`
  374 + // are not closed, as these have the same lifetime as the plugin.
381 await stop(); 375 await stop();
382 - await _barcodesController.close();  
383 - await _settingsController.close();  
384 } 376 }
385 } 377 }