value property
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
T get value => _value;
Implementation
@override
set value(TextEditingValue newValue) {
String oldText = value.text;
String newText = newValue.text;
int position = newValue.selection.end;
final diff = getDiff(oldText, newText, position);
if (diff.inserted.length == 1) {
String handledKey = handleKey(diff.inserted);
super.value = value.copyWith(
text: oldText + handledKey,
selection: value.selection.copyWith(
baseOffset: value.selection.baseOffset + handledKey.length,
extentOffset: value.selection.baseOffset + handledKey.length,
),
);
return;
}
super.value = newValue;
}