ChangeStack
changeStack, ChangeStack
Section titled “changeStack, ChangeStack”Change stack is a way to track the signal values overtime and undo or redo values.
final s = ChangeStackSignal(0, limit: 5);s.value = 1;s.value = 2;s.value = 3;print(s.value); // 3s.undo();print(s.value); // 2s.redo();print(s.value); // 3.clear
Section titled “.clear”Clear the undo/redo stack.
.canUndo
Section titled “.canUndo”Returns true if there are changes in the undo stack and can move backward.
.canRedo
Section titled “.canRedo”Returns true if there are changes in the redo stack and can move forward.
.limit
Section titled “.limit”There is an optional limit that can be set for explicit stack size.
final s = ChangeStackSignal(0, limit: 2);s.value = 1;s.value = 2;s.value = 3;print(s.value); // 3s.undo();s.undo();print(s.value); // 1print(s.canUndo); // falses.redo();print(s.value); // 2