Showing
1 changed file
with
4 additions
and
0 deletions
| @@ -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 | }); |
-
Please register or login to post a comment