truncateToDecimals method
Truncates this number to places decimal places without rounding.
Digits beyond places are dropped toward zero.
Example:
3.14159.truncateToDecimals(2); // 3.14
Audited: 2026-06-12 11:26 EDT
Implementation
@useResult
double truncateToDecimals(int places) {
final double f = math.pow(10, places).toDouble();
return (this * f).truncate() / f;
}