roundBy method

double roundBy([
  1. int base = 0
])

Round double to the nearest base.

doubleを最も近いbaseに丸めます。

Implementation

double roundBy([int base = 0]) {
  assert(base >= 0, "The base must be greater than or equal to 0.");
  if (base == 0) {
    return roundToDouble();
  }
  final p = pow(10, base);
  return (this * p).round() / p;
}