Navaron Bracke

fix missing Dispatch queue switch on MacOS

@@ -144,8 +144,10 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler, @@ -144,8 +144,10 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler,
144 } 144 }
145 } 145 }
146 } else { 146 } else {
  147 + DispatchQueue.main.async {
147 self?.sink?(FlutterError(code: "MobileScanner", message: error?.localizedDescription, details: nil)) 148 self?.sink?(FlutterError(code: "MobileScanner", message: error?.localizedDescription, details: nil))
148 } 149 }
  150 + }
149 }) 151 })
150 if(self?.symbologies.isEmpty == false){ 152 if(self?.symbologies.isEmpty == false){
151 // add the symbologies the user wishes to support 153 // add the symbologies the user wishes to support
@@ -153,11 +155,13 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler, @@ -153,11 +155,13 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler,
153 } 155 }
154 try imageRequestHandler.perform([barcodeRequest]) 156 try imageRequestHandler.perform([barcodeRequest])
155 } catch let e { 157 } catch let e {
  158 + DispatchQueue.main.async {
156 self?.sink?(FlutterError(code: "MobileScanner", message: e.localizedDescription, details: nil)) 159 self?.sink?(FlutterError(code: "MobileScanner", message: e.localizedDescription, details: nil))
157 } 160 }
158 } 161 }
159 } 162 }
160 } 163 }
  164 + }
161 165
162 func checkPermission(_ call: FlutterMethodCall, _ result: @escaping FlutterResult) { 166 func checkPermission(_ call: FlutterMethodCall, _ result: @escaping FlutterResult) {
163 if #available(macOS 10.14, *) { 167 if #available(macOS 10.14, *) {