updateEditingValueWithDeltas method

  1. @override
void updateEditingValueWithDeltas(
  1. List<TextEditingDelta> textEditingDeltas
)
override

Requests that this client update its editing state by applying the deltas received from the engine.

The list of TextEditingDelta's are treated as changes that will be applied to the client's editing state. A change is any mutation to the raw text value, or any updates to the selection and/or composing region.

{@tool snippet} This example shows what an implementation of this method could look like.

class MyClient with DeltaTextInputClient {
  TextEditingValue? _localValue;

  @override
  void updateEditingValueWithDeltas(List<TextEditingDelta> textEditingDeltas) {
    if (_localValue == null) {
      return;
    }
    TextEditingValue newValue = _localValue!;
    for (final TextEditingDelta delta in textEditingDeltas) {
      newValue = delta.apply(newValue);
    }
    _localValue = newValue;
  }

  // ...
}

{@end-tool}

Implementation

@override
void updateEditingValueWithDeltas(List<TextEditingDelta> textEditingDeltas) {
  Log.input.debug(
    textEditingDeltas.map((delta) => delta.toString()).toString(),
  );
  apply(textEditingDeltas);
}