Showing
3 changed files
with
21 additions
and
3 deletions
| @@ -15,7 +15,7 @@ class _BarcodeListScannerWithControllerState | @@ -15,7 +15,7 @@ class _BarcodeListScannerWithControllerState | ||
| 15 | with SingleTickerProviderStateMixin { | 15 | with SingleTickerProviderStateMixin { |
| 16 | BarcodeCapture? barcodeCapture; | 16 | BarcodeCapture? barcodeCapture; |
| 17 | 17 | ||
| 18 | - MobileScannerController controller = MobileScannerController( | 18 | + final MobileScannerController controller = MobileScannerController( |
| 19 | torchEnabled: true, | 19 | torchEnabled: true, |
| 20 | // formats: [BarcodeFormat.qrCode] | 20 | // formats: [BarcodeFormat.qrCode] |
| 21 | // facing: CameraFacing.front, | 21 | // facing: CameraFacing.front, |
| @@ -174,4 +174,10 @@ class _BarcodeListScannerWithControllerState | @@ -174,4 +174,10 @@ class _BarcodeListScannerWithControllerState | ||
| 174 | ), | 174 | ), |
| 175 | ); | 175 | ); |
| 176 | } | 176 | } |
| 177 | + | ||
| 178 | + @override | ||
| 179 | + void dispose() { | ||
| 180 | + controller.dispose(); | ||
| 181 | + super.dispose(); | ||
| 182 | + } | ||
| 177 | } | 183 | } |
| @@ -15,7 +15,7 @@ class _BarcodeScannerWithControllerState | @@ -15,7 +15,7 @@ class _BarcodeScannerWithControllerState | ||
| 15 | with SingleTickerProviderStateMixin { | 15 | with SingleTickerProviderStateMixin { |
| 16 | BarcodeCapture? barcode; | 16 | BarcodeCapture? barcode; |
| 17 | 17 | ||
| 18 | - MobileScannerController controller = MobileScannerController( | 18 | + final MobileScannerController controller = MobileScannerController( |
| 19 | torchEnabled: true, | 19 | torchEnabled: true, |
| 20 | // formats: [BarcodeFormat.qrCode] | 20 | // formats: [BarcodeFormat.qrCode] |
| 21 | // facing: CameraFacing.front, | 21 | // facing: CameraFacing.front, |
| @@ -172,4 +172,10 @@ class _BarcodeScannerWithControllerState | @@ -172,4 +172,10 @@ class _BarcodeScannerWithControllerState | ||
| 172 | ), | 172 | ), |
| 173 | ); | 173 | ); |
| 174 | } | 174 | } |
| 175 | + | ||
| 176 | + @override | ||
| 177 | + void dispose() { | ||
| 178 | + controller.dispose(); | ||
| 179 | + super.dispose(); | ||
| 180 | + } | ||
| 175 | } | 181 | } |
| @@ -17,7 +17,7 @@ class _BarcodeScannerReturningImageState | @@ -17,7 +17,7 @@ class _BarcodeScannerReturningImageState | ||
| 17 | BarcodeCapture? barcode; | 17 | BarcodeCapture? barcode; |
| 18 | MobileScannerArguments? arguments; | 18 | MobileScannerArguments? arguments; |
| 19 | 19 | ||
| 20 | - MobileScannerController controller = MobileScannerController( | 20 | + final MobileScannerController controller = MobileScannerController( |
| 21 | torchEnabled: true, | 21 | torchEnabled: true, |
| 22 | // formats: [BarcodeFormat.qrCode] | 22 | // formats: [BarcodeFormat.qrCode] |
| 23 | // facing: CameraFacing.front, | 23 | // facing: CameraFacing.front, |
| @@ -168,4 +168,10 @@ class _BarcodeScannerReturningImageState | @@ -168,4 +168,10 @@ class _BarcodeScannerReturningImageState | ||
| 168 | ), | 168 | ), |
| 169 | ); | 169 | ); |
| 170 | } | 170 | } |
| 171 | + | ||
| 172 | + @override | ||
| 173 | + void dispose() { | ||
| 174 | + controller.dispose(); | ||
| 175 | + super.dispose(); | ||
| 176 | + } | ||
| 171 | } | 177 | } |
-
Please register or login to post a comment