ChangeStackSignal<T> class
Change stack signal that can be used to call undo/redo on a value.
final s = ChangeStackSignal(0, limit: 5);
s.value = 1;
s.value = 2;
s.value = 3;
print(s.value); // 3
s.undo();
print(s.value); // 2
s.redo();
print(s.value); // 3
- Inheritance
-
- Object
- Signal<
T> - ValueSignal<
T> - ChangeStackSignal
- Available extensions
Constructors
- ChangeStackSignal(T value, {String? debugLabel, int? limit})
Properties
- brand → Symbol
-
finalinherited
- canRedo → bool
-
Can redo the previous change
no setter
- canUndo → bool
-
Can undo the previous change
no setter
- debugLabel → String?
-
Debug label for Debug Mode
finalinherited
-
equality
→ SignalEquality<
T> ? -
finalinherited
- globalId → int
-
Global ID of the signal
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
-
history
→ SignalChange<
T> ? -
List of changes in the history
no setter
- initialValue → T
-
Get the value the signal was created with
no setterinherited
- limit → int?
-
Max values to keep in history
final
- previousValue → T
-
Get the last value before the last update or the initial value
no setterinherited
-
redos
→ SignalChange<
T> ? -
List of changes in the redo stack
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value ↔ T
-
Compute the current value
getter/setter pairinherited-getter
Methods
-
call(
) → T -
Return the value when invoked
inherited
-
clear(
) → void - Clear the history for redo and undo
-
clearRedo(
) → void - Clear redo stack
-
clearUndo(
) → void - Clear undo stack
-
dispose(
) → void -
inherited
-
forceUpdate(
[T? val]) → void -
Should only be called to update the value of a signal if checks for equality
have already been made.
inherited
-
get(
) → T -
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onDispose(
SignalCleanup cleanup) → void -
inherited
-
peek(
) → T -
In the rare instance that you have an effect that should write to
another signal based on the previous value, but you don't want the
effect to be subscribed to that signal, you can read a signals's
previous value via
signal.peek()
.inherited -
readonly(
) → ReadonlySignal< T> -
inherited
-
redo(
) → void - Redo Previous Undo
-
set(
T value) → void -
Set the current value
inherited
-
subscribe(
void fn(T value)) → EffectCleanup -
Subscribe to value changes
inherited
-
toJson(
) → T -
Convert value to JSON
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
undo(
) → void - Undo Last Change
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited