formatFractionDigitsAsFixed function
保留n位小数
Implementation
String formatFractionDigitsAsFixed(double amount,
{int fractionDigits = 2, bool autoClearZero = false}) {
String fixed = amount.toStringAsFixed(fractionDigits);
if (autoClearZero) {
fixed = fixed.replaceAll(".00", "");
}
return fixed;
}