updateEditingValue method

  1. @override
void updateEditingValue(
  1. TextEditingValue value
)
override

Requests that this client update its editing state to the given value.

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

Implementation

@override
void updateEditingValue(TextEditingValue value) {
   _lastKnownRemoteTextEditingValue = value;

  if (value == _value) {
    // This is possible, for example, when the numeric keyboard is input,
    // the engine will notify twice for the same value.
    // Track at https://github.com/flutter/flutter/issues/65811
    return;
  }

  if (value.text == _value.text && value.composing == _value.composing) {
    // `selection` is the only change.
    _handleSelectionChanged(value.selection, SelectionChangedCause.keyboard);
  } else {
    _showCaretOnScreen();
    _textSelectionDelegate.hideToolbar();
  }
  _formatAndSetValue(value, userInteraction: true, cause: SelectionChangedCause.keyboard);

  if (_hasInputConnection) {
    // To keep the cursor from blinking while typing, we want to restart the
    // cursor timer every time a new character is typed.
    _stopCursorTimer(resetCharTicks: false);
    _startCursorTimer();
  }
}