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
Implemented types

Constructors

AsyncSignalImpl({AsyncSource<T>? source, AsyncState<T>? initialValue, JoltDebugOption? debug})
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
error Object?
The error from the current async state, if any.
no setteroverride
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
isError bool
Whether the current state represents an error.
no setteroverride
isLoading bool
Whether the current state represents a loading operation.
no setteroverride
isSuccess bool
Whether the current state represents a successful operation with data.
no setteroverride
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
stackTrace StackTrace?
The stack trace from the current async error state, if any.
no setteroverride
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>
Replaces the current async source and subscribes to the new one.
override
map<R>({R loading()?, R success(T)?, R error(Object?, StackTrace?)?}) → R?
Maps the current async state to a value based on its state variant.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notify([bool force = true]) → void
Manually notifies all subscribers that this signal has changed.
inherited
onDispose() → void
Disposes the signal and cleans up resources.
override
toString() String
A string representation of this object.
inherited

Operators

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