ReadonlySignal<T> class abstract

Read only signals can just retrieve a value but not update or cause mutations

Properties

autoDispose bool
Throws and error if read after dispose and can be disposed on last unsubscribe.
final
debugLabel String?
Debug label for Debug Mode
final
disposed bool
Returns true if dispose has been called and will throw and error on value read
getter/setter pair
globalId int
Global ID of the signal
final
hashCode int
The hash code for this object.
no setterinherited
hasTargets bool
Check if there are any targets attached
no setter
initialValue → T
Value that the signal was created with
no setter
isInitialized bool
Check if the signal is lazy and has not had a value set
no setter
previousValue → T?
Previous value that was set before the current
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 setter
value → T
Compute the current value
no setter
version int
Version number is used to track changes and will increment for every set
no setter

Methods

call() → T
Return the value when invoked
dispose() → void
Dispose the signal
get() → T
Get the current value
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
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().
subscribe(void fn(T value)) → EffectCleanup
Subscribe to value changes
toJson() → dynamic
Convert value to JSON
toString() String
A string representation of this object.
override

Operators

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