I made a custom function to calculate the percentage from two given values.
both come in as doubles, and the function output is an int.
int calculateSpendingPercent(
double income,
double outgoings,
) {
/// MODIFY CODE ONLY BELOW THIS LINE
if (income <= 0) {
return 0;
}
return ((outgoings / income) * 100).toInt();
/// MODIFY CODE ONLY ABOVE THIS LINE
}
The problem is... if I set income to 1000 and outgoings to 200, then the result becomes 2000.
But if I remove the * 100
then the result becomes 0.
I've also tried returning a double instead of an int and get the same results.
What am I doing wrong? How am I never getting 20 as the result?
Is there really no way to do normal debugging things like prints and breakpoints in Flutter Flow?