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, {int? limit, String? debugLabel, bool autoDispose = false})
Change stack signal that can be used to call undo/redo on a value.

Properties

autoDispose bool
Throws and error if read after dispose and can be disposed on last unsubscribe.
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
disposed bool
Returns true if dispose has been called and will throw and error on value read
getter/setter pairinherited
equalityCheck bool Function(T a, T b)
Optional method to check if to values are the same
getter/setter pairinherited
globalId int
Global ID of the signal
finalinherited
hashCode int
The hash code for this object.
no setterinherited
hasTargets bool
Check if there are any targets attached
no setterinherited
history Iterable<SignalChange<T>>
List of changes in the history
no setter
initialValue → T
Value that the signal was created with
no setterinherited
isInitialized bool
Check if the signal is lazy and has not had a value set
no setterinherited
limit int?
Max values to keep in history
final
previousValue → T?
Previous value that was set before the current
no setterinherited
redos Iterable<SignalChange<T>>
List of changes in the redo stack
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
targets Iterable<SignalListenable>
@internal for testing getter to track all the effects currently effected in the signal
no setterinherited
value ↔ T
Compute the current value
getter/setter pairinherited
version int
Version number is used to track changes and will increment for every set
no setterinherited

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
Dispose the signal
inherited
forceUpdate([T? val]) → void
Force update a value
inherited
get() → T
Get the current value
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(void cleanup()) EffectCleanup
Add a cleanup function to be called when the signal is disposed
inherited
overrideWith(T val) Signal<T>
Override the current signal with a new value as if it was created with it
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>
Returns a readonly signal
inherited
redo() → void
Redo Previous Undo
select<R>(R selector(ReadonlySignal<T>), {bool autoDispose = false, String? debugLabel}) Computed<R>

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

Select a value and return a computed signal to listen for changes
set(T val, {bool force = false}) bool
Update the current value.
override
subscribe(void fn(T value)) EffectCleanup
Subscribe to value changes
inherited
toJson() → dynamic
Convert value to JSON
inherited
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.
toString() String
A string representation of this object.
inherited
toValueListenable() SignalValueListenable<T, ValueListenable<T>, ReadonlySignal<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() SignalValueNotifier<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
unlisten(BuildContext context, void callback()) → void

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

Stop subscriptions to updates on a signal for listeners
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