value property

  1. @override
TextEditingValue value
override

The current value stored in this notifier.

When the value is replaced with something that is not equal to the old value as evaluated by the equality operator ==, this class notifies its listeners.

Implementation

@override
TextEditingValue get value => _textController.value;
  1. @override
void value=(TextEditingValue value)
override

Implementation

@override
set value(TextEditingValue value) {
  if (value == this.value) {
    return;
  }

  if (_ignoreSetValue) {
    _textController.value = value;
  } else {
    final pValue = processTextValue(this, value);
    // We set the cursor at the end of the inserted text for diffing purposes
    // when it is invalid.
    final cursor = pValue.selection.isValid
        ? pValue.selection.baseOffset
        : pValue.text.length;
    final diff = diffStrings(text, pValue.text, cursor);
    spans = spans
        .collapse(diff.deletedRange)
        .shift(diff.index, diff.inserted.length);
    _applyOverrides(
      Range(diff.index, diff.index + diff.inserted.length),
    );

    if (pValue.selection != _textController.selection ||
        pValue.text != _textController.text) {
      _attributeOverrides.clear();
    }

    _textController.value = pValue;
  }
}