Showing
2 changed files
with
3 additions
and
2 deletions
| @@ -16,8 +16,7 @@ class _BarcodeScannerWithControllerState | @@ -16,8 +16,7 @@ class _BarcodeScannerWithControllerState | ||
| 16 | String? barcode; | 16 | String? barcode; |
| 17 | 17 | ||
| 18 | MobileScannerController controller = MobileScannerController( | 18 | MobileScannerController controller = MobileScannerController( |
| 19 | - torchEnabled: true, | ||
| 20 | - // formats: [BarcodeFormat.qrCode] | 19 | + torchEnabled: true, formats: [BarcodeFormat.qrCode] |
| 21 | // facing: CameraFacing.front, | 20 | // facing: CameraFacing.front, |
| 22 | ); | 21 | ); |
| 23 | 22 |
| @@ -178,8 +178,10 @@ public class SwiftMobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHan | @@ -178,8 +178,10 @@ public class SwiftMobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHan | ||
| 178 | formatList.add(BarcodeFormat(rawValue: index)) | 178 | formatList.add(BarcodeFormat(rawValue: index)) |
| 179 | } | 179 | } |
| 180 | 180 | ||
| 181 | + if (formatList.count != 0) { | ||
| 181 | let barcodeOptions = BarcodeScannerOptions(formats: formatList.firstObject as! BarcodeFormat) | 182 | let barcodeOptions = BarcodeScannerOptions(formats: formatList.firstObject as! BarcodeFormat) |
| 182 | scanner = BarcodeScanner.barcodeScanner(options: barcodeOptions) | 183 | scanner = BarcodeScanner.barcodeScanner(options: barcodeOptions) |
| 184 | + } | ||
| 183 | 185 | ||
| 184 | // Set the camera to use | 186 | // Set the camera to use |
| 185 | position = facing == 0 ? AVCaptureDevice.Position.front : .back | 187 | position = facing == 0 ? AVCaptureDevice.Position.front : .back |
-
Please register or login to post a comment