Cannot understand the error in this custom code

Troubleshooting

Hi,
I am trying to write a custom code that returns some values after I do come basic percentage caldulations. Somehow the code keeps giving me error without any explanation of where in the code the error is.

Can someone help with this?

What have you tried so far?

Here is the code I have written so far
The line of code I have bolded is the one most likely causing the error but cant figure out whats wrong with it?

String? calculateImagePercentage(

int? image1,
int? image2,
int? image3,
int? image4,
int? calcFor,
int? imageNum,
) {
/// MODIFY CODE ONLY BELOW THIS LINE
String percentValue = "";
if (imageNum == 2) {
if (imageNum == 1) {
if (image1 == 0) {
percentValue = "0%";
} else {
var n = ((image1 / (image1 + image2))*100).ceil();
percentValue = n.toString();
}
}
}
if (imageNum == 4) {
percentValue = "4";
}
return percentValue;
/// MODIFY CODE ONLY ABOVE THIS LINE
}

Did you check FlutterFlow's Documentation for this topic?
No
1
4 replies