leastSignificantDigit method Null safety

  1. @override
int leastSignificantDigit(
  1. double value
)
override

See DisplayMode.leastSignificantDigit

This assumes scientific notation, and is overriden for fixed-point.

Implementation

@override
int leastSignificantDigit(double value) {
  if (value != 0) {
    final r = log(value.abs()).floor();
    if (r < -fractionDigits || r >= 10) {
      return r - fractionDigits; // Same as super.leastSignificantDigit()
    }
  }
  return -fractionDigits;
}