Navaron Bracke

set return image flag on macos

@@ -25,6 +25,10 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler, @@ -25,6 +25,10 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler,
25 25
26 // optional window to limit scan search 26 // optional window to limit scan search
27 var scanWindow: CGRect? 27 var scanWindow: CGRect?
  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
28 32
29 var detectionSpeed: DetectionSpeed = DetectionSpeed.noDuplicates 33 var detectionSpeed: DetectionSpeed = DetectionSpeed.noDuplicates
30 34
@@ -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)!