Skip to content

Commit

Permalink
fix: Fixed an issue with QR code scanning on Android.
Browse files Browse the repository at this point in the history
  • Loading branch information
Skyost committed Jul 11, 2024
1 parent ad0ed48 commit d711b50
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/utils/camera.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,17 @@ extension CameraImageToInputImage on CameraImage {
if (planes.isEmpty) {
return null;
}
Plane plane = planes.first;

// compose InputImage using bytes
return InputImage.fromBytes(
bytes: plane.bytes,
bytes: Uint8List.fromList(
planes.fold([], (previousValue, element) => previousValue..addAll(element.bytes)),
),
metadata: InputImageMetadata(
size: Size((plane.width ?? width).toDouble(), (plane.height ?? height).toDouble()),
size: Size((planes.first.width ?? width).toDouble(), (planes.first.height ?? height).toDouble()),
rotation: rotation, // used only in Android
format: format, // used only in iOS
bytesPerRow: plane.bytesPerRow, // used only in iOS
bytesPerRow: planes.first.bytesPerRow, // used only in iOS
),
);
}
Expand Down

0 comments on commit d711b50

Please sign in to comment.