formatInt function
Implementation
String? formatInt(
int? number, {
String? def,
int scale = 1,
bool fixZero = false,
int decimalLength = 2,
}) {
if (number == null) return def;
var temp = (Decimal.fromInt(number) / Decimal.fromInt(scale))
.toStringAsFixed(decimalLength);
if (fixZero) {
while (temp.contains('.') && (temp.endsWith('0') || temp.endsWith('.'))) {
temp = temp.substring(0, temp.length - 1);
}
}
return temp;
}