priceFloor static method
number transform 6: from
Implementation
static String priceFloor(
double? value, {
int lengthFixed = 2,
int? lengthMax,
}) {
if (value == null) {
return '~';
}
final int x = pow(10, lengthMax ?? lengthFixed) as int;
final double price = (value * x).floorToDouble() / x;
final String tailDecimals =
lengthMax == null ? '' : "#" * (lengthMax - lengthFixed);
return NumberFormat(
",##0${lengthFixed > 0 ? '.' : ''}${"0" * lengthFixed}$tailDecimals",
"en_US")
.format(price);
}