updateEditingValue method

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

Implemented from TextInputClient. This should never be called directly; instead, use the _controller to set the editing value

Implementation

@override
void updateEditingValue(TextEditingValue value) {
  bool isUserInput = _lastDirectState == value.text;
  _lastDirectState = null;
  String newText = value.text;
  final inputValue = String.fromCharCodes(
      newText.codeUnits.where((c) => c != kObjectReplacementChar));
  final oldCount = _chips.length;
  final newCount = _countReplacements(newText);
  if (isUserInput && newCount < oldCount && inputValue.isNotNullOrBlank) {
    // If resetQuery = true here, then it ends up removing some chip updates
    // as soon as they happen
    _controller!.updateChips(_chips.take(newCount),
        source: ChipChangeOperation.deleteChip, resetQuery: false);
  }

  _queryText!.query = inputValue;
  if (mounted) {
    _controller!.setQuery(inputValue);
  }
}