Every time I run my app. It shows
"Null check operator used on a null value".
I have shown some solutions but couldn't successfully apply them to my code. How do I solve this?
import 'dart:math';
class bmicalculator {
bmicalculator({required this.height, required this.weight});
int height;
double weight;
double? bmi;
String Calculation() {
bmi = weight / pow(height / 100, 2);
return bmi!.toStringAsFixed(2);
}
String getResult() {
if (bmi! >= 25) {
return 'Overweight';
} else if (bmi! > 18.5) {
return 'Normal';
} else
return 'UnderWeight';
}
String getInterpretation() {
if (bmi! >= 25) {
return 'String 1';
} else if (bmi! > 18.5) {
return 'String 2';
} else
return 'String 3';
}
}