undo method

void undo()

Replaces the text/selection with the cached version. This wipes the two cached properties => this method is not idempotent

Implementation

void undo() {
  if (_cachedText == null) {
    throw Exception("Cannot call undo if _cachedText is null!");
  }

  editorFocusNode?.requestFocus();

  value = value.copyWith(
    text: _cachedText!,
    selection: _cachedSelection,
  );

  _clearCache();
}