np method

double np(
  1. int digits
)

Rounds to digits digits.

Implementation

double np(int digits) {
  final p = pow(10, digits);
  return (this * p).roundToDouble() / p;
}