Closed Noor-Mahammad closed 1 year ago
Hi Rafael,
A bit more info...
I only get this on iOS and not Android:
flutter: ERROR(decodePlanes):Null check operator used on a null value
I've run in debug and the error is happening in "transformToLuminanceSource" in "decoder/global_functions.dart".
On Android (Android 13 (API 33)): e.bytesPerPixel = 0 On iOS (iOS 16.6 20G75): e.bytesPerPixel = null
The null exception is thrown during the "map" to get the "total":
final total = planes
.map<double>((p) => p.bytesPerPixel!.toDouble())
.reduce((value, element) => value + 1 / element)
.toInt();
In the definition of "Plane" in "camera_image.dart" it says:
/// The distance between adjacent pixel samples on Android, in bytes.
///
/// Will be `null` on iOS.
final int? bytesPerPixel;
So I've put in a null test and a default of "1" in "transformToLuminanceSource" and that works for me on iOS.
I'll submit a pull request for you to check.
Cheers Phil
Wow. Thanks so much @philseeley ! I'm wait anxious for your PR.
When I'm trying to scan a QR in live it showing me like this ERROR:Null check operator used on a null value