Committed by
GitHub
Merge pull request #568 from monsieurtanuki/fix/544
fix: 544 - explicit returned type for compactMap
Showing
1 changed file
with
2 additions
and
2 deletions
| @@ -38,7 +38,7 @@ public class SwiftMobileScannerPlugin: NSObject, FlutterPlugin { | @@ -38,7 +38,7 @@ public class SwiftMobileScannerPlugin: NSObject, FlutterPlugin { | ||
| 38 | init(barcodeHandler: BarcodeHandler, registry: FlutterTextureRegistry) { | 38 | init(barcodeHandler: BarcodeHandler, registry: FlutterTextureRegistry) { |
| 39 | self.mobileScanner = MobileScanner(registry: registry, mobileScannerCallback: { barcodes, error, image in | 39 | self.mobileScanner = MobileScanner(registry: registry, mobileScannerCallback: { barcodes, error, image in |
| 40 | if barcodes != nil { | 40 | if barcodes != nil { |
| 41 | - let barcodesMap = barcodes!.compactMap { barcode in | 41 | + let barcodesMap: [Any?] = barcodes!.compactMap { barcode in |
| 42 | if (SwiftMobileScannerPlugin.scanWindow != nil) { | 42 | if (SwiftMobileScannerPlugin.scanWindow != nil) { |
| 43 | if (SwiftMobileScannerPlugin.isBarcodeInScanWindow(barcode: barcode, imageSize: image.size)) { | 43 | if (SwiftMobileScannerPlugin.isBarcodeInScanWindow(barcode: barcode, imageSize: image.size)) { |
| 44 | return barcode.data | 44 | return barcode.data |
| @@ -223,7 +223,7 @@ public class SwiftMobileScannerPlugin: NSObject, FlutterPlugin { | @@ -223,7 +223,7 @@ public class SwiftMobileScannerPlugin: NSObject, FlutterPlugin { | ||
| 223 | 223 | ||
| 224 | mobileScanner.analyzeImage(image: uiImage!, position: AVCaptureDevice.Position.back, callback: { [self] barcodes, error in | 224 | mobileScanner.analyzeImage(image: uiImage!, position: AVCaptureDevice.Position.back, callback: { [self] barcodes, error in |
| 225 | if error == nil && barcodes != nil && !barcodes!.isEmpty { | 225 | if error == nil && barcodes != nil && !barcodes!.isEmpty { |
| 226 | - let barcodesMap = barcodes!.compactMap { barcode in barcode.data } | 226 | + let barcodesMap: [Any?] = barcodes!.compactMap { barcode in barcode.data } |
| 227 | let event: [String: Any?] = ["name": "barcode", "data": barcodesMap] | 227 | let event: [String: Any?] = ["name": "barcode", "data": barcodesMap] |
| 228 | barcodeHandler.publishEvent(event) | 228 | barcodeHandler.publishEvent(event) |
| 229 | result(true) | 229 | result(true) |
-
Please register or login to post a comment