AsyncSignalImpl<T> class
Implementation of AsyncSignal that manages async state transitions.
This is the concrete implementation of the AsyncSignal interface. AsyncSignal wraps an AsyncSource and provides a reactive interface to async operations, automatically managing state transitions and providing convenient access to the current async state.
See AsyncSignal for the public interface and usage examples.
Example:
final future = Future.delayed(Duration(seconds: 1), () => 'Hello');
final signal = AsyncSignal.fromFuture(future);
// React to state changes
Effect(() {
final state = signal.value;
if (state.isLoading) print('Loading...');
if (state.isSuccess) print('Data: ${state.data}');
if (state.isError) print('Error: ${state.error}');
});
- Inheritance
-
- Object
- ReactiveNode
- SignalReactiveNode<
AsyncState< T> > - SignalImpl<
AsyncState< T> > - AsyncSignalImpl
- Implemented types
-
- AsyncSignal<
T>
- AsyncSignal<
Constructors
-
AsyncSignalImpl({AsyncSource<
T> ? source, AsyncState<T> ? initialValue, JoltDebugFn? onDebug}) - Creates an async signal with the given source.
Properties
-
cachedValue
↔ AsyncState<
T> ? -
getter/setter pairinherited
- data → T?
-
Gets the data from the current async state.
no setteroverride
- deps ↔ Link?
-
First dependency link in the chain.
getter/setter pairinherited
- depsTail ↔ Link?
-
Last dependency link in the chain.
getter/setter pairinherited
- flags ↔ int
-
Reactive flags for this node.
getter/setter pairinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isDisposed → bool
-
Whether this node has been disposed.
no setterinherited
-
peek
→ AsyncState<
T> -
Returns the current value without establishing a reactive dependency.
no setterinherited
-
pendingValue
↔ AsyncState<
T> ? -
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- subs ↔ Link?
-
First subscriber link in the chain.
getter/setter pairinherited
- subsTail ↔ Link?
-
Last subscriber link in the chain.
getter/setter pairinherited
-
value
↔ AsyncState<
T> -
Returns the current value and establishes a reactive dependency.
getter/setter pairinherited
Methods
-
dispose(
) → void -
Disposes this node and cleans up resources.
inherited
-
fetch(
AsyncSource< T> source) → Future<void> -
get(
) → AsyncState< T> -
Returns the current value and establishes a reactive dependency.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notify(
) → void -
Manually notifies all subscribers that this signal has changed.
inherited
-
onDispose(
) → void -
Disposes the signal and cleans up resources.
inherited
-
set(
AsyncState< T> value) → AsyncState<T> -
Sets a new value for the signal and notifies subscribers when it changes.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited