roundTo method
Rounds the number to the specified number of decimal places.
Example:
3.14159.roundTo(2); // 3.14
Implementation
double roundTo(int decimals) {
assert(decimals >= 0, 'decimals must be non-negative');
final factor = pow(10, decimals).toDouble();
return (this * factor).round() / factor;
}