enesbayar

Assigned the value only if it is null

@@ -123,7 +123,7 @@ class _MobileScannerState extends State<MobileScanner> @@ -123,7 +123,7 @@ class _MobileScannerState extends State<MobileScanner>
123 return; 123 return;
124 } 124 }
125 125
126 - _barcodesSubscription = _controller.barcodes.listen( 126 + _barcodesSubscription ??= _controller.barcodes.listen(
127 widget.onDetect, 127 widget.onDetect,
128 ); 128 );
129 129