decimal property

Decimal decimal

Implementation

Decimal get decimal =>
    data ?? Decimal(precision: (validator as DecimalValidator).precision);
void decimal=(Decimal dec)

Implementation

set decimal(Decimal dec) {
  if (dec.doubleValue.toStringAsFixed(0).length > 12) {
    dec.doubleValue = _lastValue;
  } else {
    _lastValue = dec.doubleValue;
  }

  String masked = validator.format(dec);

  if (masked != super.text) {
    super.text = masked;

    int cursorPosition = super.text.length;

    super.selection = TextSelection.fromPosition(
      TextPosition(
        offset: cursorPosition,
      ),
    );
  }
}