undo method

void undo()

Implementation

void undo() {
  if (!canUndo) return;
  _historyIndex--;
  state = _history[_historyIndex];
}