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.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<
Used to listen for updates on a signal but not rebuild the nearest elementT> , provided by the FlutterReadonlySignalUtils extension -
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<
Select a value and return a computed signal to listen for changesT> , provided by the ReadonlySignalUtils extension -
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<
Restrict API to readonly signalT> , provided by the SignalUtils extension -
toStream(
) → Stream< T> -
Available on ReadonlySignal<
Convert a signal to a Stream to be consumed as a read only stream and also be used in a StreamBuilderT> , provided by the ReadonlySignalUtils extension -
toString(
) → String -
A string representation of this object.
inherited
-
toValueListenable(
) → ValueListenable< T> -
Available on ReadonlySignal<
Convert a signal to ValueListenable to be used in builders and other existing widgets like ValueListenableBuilderT> , provided by the FlutterReadonlySignalUtils extension -
toValueNotifier(
) → ValueNotifier< T> -
Available on Signal<
Convert a ValueListenable to Signal to be used in builders and other existing widgets like ValueListenableBuilder and allow for mutationT> , provided by the FlutterSignalUtils extension -
undo(
) → void - Undo Last Change
-
unwatch(
BuildContext context) → void -
Available on ReadonlySignal<
Stop subscriptions to updates on a signal for watchersT> , provided by the FlutterReadonlySignalUtils extension -
watch(
BuildContext context, {String? debugLabel}) → T -
Available on ReadonlySignal<
Rebuild the Element that the current signal is inside ofT> , provided by the FlutterReadonlySignalUtils extension
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited