toPrecision method

double toPrecision(
  1. int fractionDigits
)

Implementation

double toPrecision(int fractionDigits) {
  final mod = pow(10, fractionDigits.toDouble()).toDouble();
  return (this * mod).round().toDouble() / mod;
}