undo method

bool undo()

Undo the last operation

Implementation

bool undo() {
  if (!canUndo || _applyEdit == null) return false;

  final operation = _undoStack.removeLast();
  final inverse = operation.inverse();

  _isUndoRedoInProgress = true;
  try {
    _applyEdit!(inverse);
    _redoStack.add(operation);
  } finally {
    _isUndoRedoInProgress = false;
  }

  notifyListeners();
  return true;
}