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
Available extensions

Constructors

ChangeStackSignal.new(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
listen(BuildContext context, void callback(), {String? debugLabel}) → void

Available on ReadonlySignal<T>, provided by the FlutterReadonlySignalUtils extension

Used to listen for updates on a signal but not rebuild the nearest element
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
select<R>(R selector(ReadonlySignal<T>)) ReadonlySignal<R>

Available on ReadonlySignal<T>, provided by the ReadonlySignalUtils extension

Select a value and return a computed signal to listen for changes
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
toReadonlySignal() ReadonlySignal<T>

Available on Signal<T>, provided by the SignalUtils extension

Restrict API to readonly signal
toStream() Stream<T>

Available on ReadonlySignal<T>, provided by the ReadonlySignalUtils extension

Convert a signal to a Stream to be consumed as a read only stream and also be used in a StreamBuilder
toString() String
A string representation of this object.
inherited
toValueListenable() ValueListenable<T>

Available on ReadonlySignal<T>, provided by the FlutterReadonlySignalUtils extension

Convert a signal to ValueListenable to be used in builders and other existing widgets like ValueListenableBuilder
toValueNotifier() ValueNotifier<T>

Available on Signal<T>, provided by the FlutterSignalUtils extension

Convert a ValueListenable to Signal to be used in builders and other existing widgets like ValueListenableBuilder and allow for mutation
undo() → void
Undo Last Change
unwatch(BuildContext context) → void

Available on ReadonlySignal<T>, provided by the FlutterReadonlySignalUtils extension

Stop subscriptions to updates on a signal for watchers
watch(BuildContext context, {String? debugLabel}) → T

Available on ReadonlySignal<T>, provided by the FlutterReadonlySignalUtils extension

Rebuild the Element that the current signal is inside of

Operators

operator ==(Object other) bool
The equality operator.
inherited