SignalUtils class
============================================================================ UTILITIES
Utility methods for creating and managing signals.
Basic Usage
// From Stream
final streamSignal = SignalUtils.fromStream(myStream, initialValue);
// From Future
final futureSignal = SignalUtils.fromFuture(myFuture);
// Polling
final pollSignal = SignalUtils.poll(
() => fetchStatus(),
Duration(seconds: 5),
'initial',
);
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
bind<
T> (Signal< T> signal1, Signal<T> signal2) → void - Bind two signals bidirectionally.
-
cached<
T> (T compute(), {Duration? ttl}) → Computed< T> - Create a signal that caches computed values.
-
clamped(
num initialValue, {required num min, required num max}) → MiddlewareSignal< num> - Create a clamped numeric signal.
-
fromFuture<
T> (Future< T> future) → AsyncSignal<T> - Create a signal from a future.
-
fromStream<
T> (Stream< T> stream, T initialValue) → Signal<T> - Create a signal from a stream.
-
lazy<
T> (T initializer()) → Signal< T> - Create a lazy signal that only computes value when accessed.
-
logged<
T> (T initialValue, {String? label}) → MiddlewareSignal< T> - Create a logged signal.
-
poll<
T> (Future< T> getter(), Duration interval, T initialValue) → Signal<T> - Create a polling signal that updates periodically.
-
toggle(
bool initialValue) → Signal< bool> - Create a toggle signal (boolean).
-
validated<
T> (T initialValue, bool validator(T value), {T fallback(T invalidValue)?}) → MiddlewareSignal< T> - Create a validated signal with middleware.
-
waitFor<
T> (Signal< T> signal, bool condition(T value), {Duration? timeout}) → Future<T> - Wait for a signal to meet a condition.