Navaron Bracke

set return image flag on macos

@@ -26,6 +26,10 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler, @@ -26,6 +26,10 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler,
26 // optional window to limit scan search 26 // optional window to limit scan search
27 var scanWindow: CGRect? 27 var scanWindow: CGRect?
28 28
  29 + /// Whether to return the input image with the barcode event.
  30 + /// This is static to avoid accessing `self` in the `VNDetectBarcodesRequest` callback.
  31 + private static var returnImage: Bool = false
  32 +
29 var detectionSpeed: DetectionSpeed = DetectionSpeed.noDuplicates 33 var detectionSpeed: DetectionSpeed = DetectionSpeed.noDuplicates
30 34
31 var timeoutSeconds: Double = 0 35 var timeoutSeconds: Double = 0
@@ -261,6 +265,7 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler, @@ -261,6 +265,7 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler,
261 let speed:Int = argReader.int(key: "speed") ?? 0 265 let speed:Int = argReader.int(key: "speed") ?? 0
262 let timeoutMs:Int = argReader.int(key: "timeout") ?? 0 266 let timeoutMs:Int = argReader.int(key: "timeout") ?? 0
263 symbologies = argReader.toSymbology() 267 symbologies = argReader.toSymbology()
  268 + MobileScannerPlugin.returnImage = argReader.bool(key: "returnImage") ?? false
264 269
265 timeoutSeconds = Double(timeoutMs) / 1000.0 270 timeoutSeconds = Double(timeoutMs) / 1000.0
266 detectionSpeed = DetectionSpeed(rawValue: speed)! 271 detectionSpeed = DetectionSpeed(rawValue: speed)!