Navaron Bracke

fix bug with context mounted

@@ -29,6 +29,10 @@ class _BarcodeScannerWithZoomState extends State<BarcodeScannerWithZoom> @@ -29,6 +29,10 @@ class _BarcodeScannerWithZoomState extends State<BarcodeScannerWithZoom>
29 void initState() { 29 void initState() {
30 super.initState(); 30 super.initState();
31 _barcodesSubscription = controller.barcodes.listen((event) { 31 _barcodesSubscription = controller.barcodes.listen((event) {
  32 + if (!context.mounted) {
  33 + return;
  34 + }
  35 +
32 setState(() { 36 setState(() {
33 barcode = event; 37 barcode = event;
34 }); 38 });