adjustPrecision method

num adjustPrecision (
  1. num value
)

Return the value adjusted by defined precision

Implementation

num adjustPrecision(num value) {
  if (tryInt && value == value.toInt()) return value;

  // add "epsilon" to ensure numbers like 1.000000005
  // (represented as 1.000000004999....) are properly rounded...
  return precision != null
      ? double.parse((value + 2e-16).toStringAsFixed(precision))
      : value;
}