precision property

int get precision

The precision of this Decimal.

The precision is the number of digits in the unscaled value.

Decimal.parse('0').precision; // => 1
Decimal.parse('1').precision; // => 1
Decimal.parse('1.5').precision; // => 2
Decimal.parse('0.5').precision; // => 2

Implementation

int get precision {
  final value = abs();
  return value.scale + value.toBigInt().toString().length;
}