roundToPrecision method

double roundToPrecision(
  1. int n
)

round a double to with a precision of given n digit

Implementation

double roundToPrecision(int n) {
  final f = pow(10, n);
  return (this * f).round() / f;
}