Navaron Bracke

update the image parsing from the method channel

@@ -72,13 +72,16 @@ class MethodChannelMobileScanner extends MobileScannerPlatform { @@ -72,13 +72,16 @@ class MethodChannelMobileScanner extends MobileScannerPlatform {
72 72
73 if (defaultTargetPlatform == TargetPlatform.android || 73 if (defaultTargetPlatform == TargetPlatform.android ||
74 defaultTargetPlatform == TargetPlatform.iOS) { 74 defaultTargetPlatform == TargetPlatform.iOS) {
75 - final double? width = event['width'] as double?;  
76 - final double? height = event['height'] as double?; 75 + final Map<String, Object?>? imageData =
  76 + event['image'] as Map<String, Object?>?;
  77 + final Uint8List? image = imageData?['bytes'] as Uint8List?;
  78 + final double? width = imageData?['width'] as double?;
  79 + final double? height = imageData?['height'] as double?;
77 80
78 return BarcodeCapture( 81 return BarcodeCapture(
79 raw: data, 82 raw: data,
80 barcodes: barcodes.map(Barcode.fromNative).toList(), 83 barcodes: barcodes.map(Barcode.fromNative).toList(),
81 - image: event['image'] as Uint8List?, 84 + image: image,
82 size: width == null || height == null ? Size.zero : Size(width, height), 85 size: width == null || height == null ? Size.zero : Size(width, height),
83 ); 86 );
84 } 87 }