percentage function
Calculate the percentage of a number, and round the result if pass the optional parameter
Implementation
double percentage(
{required dynamic value, required dynamic total, int? round}) {
var valueParsed = toDouble(value);
var totalParsed = toDouble(total);
var result = (valueParsed * 100) / totalParsed;
if (round == null) {
return result;
} else {
return fixedDecimais(value: result, decimalPlaces: round);
}
}