Skip to content

Commit d711b50

Browse files
committed
fix: Fixed an issue with QR code scanning on Android.
1 parent ad0ed48 commit d711b50

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/utils/camera.dart

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,17 @@ extension CameraImageToInputImage on CameraImage {
4747
if (planes.isEmpty) {
4848
return null;
4949
}
50-
Plane plane = planes.first;
5150

5251
// compose InputImage using bytes
5352
return InputImage.fromBytes(
54-
bytes: plane.bytes,
53+
bytes: Uint8List.fromList(
54+
planes.fold([], (previousValue, element) => previousValue..addAll(element.bytes)),
55+
),
5556
metadata: InputImageMetadata(
56-
size: Size((plane.width ?? width).toDouble(), (plane.height ?? height).toDouble()),
57+
size: Size((planes.first.width ?? width).toDouble(), (planes.first.height ?? height).toDouble()),
5758
rotation: rotation, // used only in Android
5859
format: format, // used only in iOS
59-
bytesPerRow: plane.bytesPerRow, // used only in iOS
60+
bytesPerRow: planes.first.bytesPerRow, // used only in iOS
6061
),
6162
);
6263
}

0 commit comments

Comments
 (0)