roundTo method

double roundTo(
  1. int decimalPlaces
)

Implementation

double roundTo(int decimalPlaces) {
  double mod = pow(10.0, decimalPlaces).toDouble();
  return (this * mod).round().toDouble() / mod;
}