apply method Null safety

  1. @override
TextEditingValue apply(
  1. TextEditingValue value

This method will take the given TextEditingValue and return a new TextEditingValue with that instance of TextEditingDelta applied to it.


TextEditingValue apply(TextEditingValue value) {
  // To stay inline with the plain text model we should follow a last write wins
  // policy and apply the delta to the oldText. This is due to the asyncronous
  // nature of the connection between the framework and platform text input plugins.
  assert(_debugTextRangeIsValid(selection, oldText), 'Applying TextEditingDeltaNonTextUpdate failed, the selection range: $selection is not within the bounds of $oldText of length: ${oldText.length}');
  assert(_debugTextRangeIsValid(composing, oldText), 'Applying TextEditingDeltaNonTextUpdate failed, the composing region: $composing is not within the bounds of $oldText of length: ${oldText.length}');
  return TextEditingValue(text: oldText, selection: selection, composing: composing);