I just finished my coding based on udemy course....but a problem called "noSuchMethodError:The getter "height" was called on null ..the reciever :null" I dont know why ..I tried a lot of thing but the error is still there espicially the unused parameter null ...the udemy course do it that way but it is still even if I changed it with underscore the error doesnot changed
that is all method related to height variable
that is in the ScannerUtil Class
static Future<dynamic> detect({
u/required CameraImage image,
u/required Future<dynamic> Function(FirebaseVisionImage image) detectInImage,//
}) async {
return detectInImage(
FirebaseVisionImage.fromBytes(
_concatenatePlanes(image.planes),
_buildMetaData(image,null ),//null has an error and I dont know why because the udemy code do it that way
),
);
}
static FirebaseVisionImageMetadata _buildMetaData(
CameraImage image,
ImageRotation rotation,
) {
return FirebaseVisionImageMetadata(
rawFormat: image.format.raw,
size: Size(image.width.toDouble(), image.height.toDouble()),
//rotation: rotation,
planeData: image.planes.map(
(Plane plane) {
return FirebaseVisionImagePlaneMetadata(
bytesPerRow: plane.bytesPerRow,
height: plane.height,
width: plane.width,
);
},
).toList(),
);
}
and that themethod detect after calling it in main
doBarcodeScanning() async {
ScannerUtils.detect(
image: img,
detectInImage: labeler.detectInImage,
).then((dynamic results) {
result = "";
if (results is List<Barcode>) {
List<Barcode> labels = results;
setState(() {
for (Barcode barcode in labels) {
final BarcodeValueType valueType = barcode.valueType;
result += valueType.toString() + "\n";
switch (valueType) {
case BarcodeValueType.wifi:
final String ssid = barcode.wifi.ssid;
final String password = barcode.wifi.password;
final BarcodeWiFiEncryptionType type =
barcode.wifi.encryptionType;
result += ssid + "\n" + password;
break;
case BarcodeValueType.url:
final String title = barcode.url.title;
final String url = barcode.url.url;
result += title + "\n" + url;
break;
case BarcodeValueType.email:
result += barcode.email.body;
break;
}
}
});
}
})
.whenComplete(() => isBusy = false);
}