redo method
Redo one command group if possible.
Implementation
bool redo({required State state}) {
if (_redoStack.isEmpty) return false;
final command = _redoStack.removeLast();
command.apply(state);
if (_undoStack.isEmpty) {
_undoStack.add(command);
} else {
final last = _undoStack.last;
final merged = last.mergeWith(command);
if (merged != null) {
_undoStack[_undoStack.length - 1] = merged;
} else {
_undoStack.add(command);
}
}
return true;
}