undo method

void undo()

Undoes the last action.

Implementation

void undo() {
  if (!canUndo) return;
  _redoStack.add(_shapes.map((s) => s.clone()).toList());
  _shapes..clear()..addAll(_undoStack.removeLast());
  _selectedShape = null;
  onSelectionChanged?.call(null);
  _notify();
}