userUpdateTextEditingValue method

  1. @override
void userUpdateTextEditingValue(
  1. TextEditingValue value,
  2. SelectionChangedCause? cause
)
override

Indicates that the user has requested the delegate to replace its current text editing state with value.

The new value is treated as user input and thus may subject to input formatting.

See also:

Implementation

@override
void userUpdateTextEditingValue(
    TextEditingValue value, SelectionChangedCause? cause) {
  // Compare the current TextEditingValue with the pre-format new
  // TextEditingValue value, in case the formatter would reject the change.
  final bool shouldShowCaret =
      widget.readOnly ? _value.selection != value.selection : _value != value;
  if (shouldShowCaret) {
    _scheduleShowCaretOnScreen();
  }
  _formatAndSetValue(value, cause, userInteraction: true);
}