signals_core
library
Classes
AsyncData <T >
State for an AsyncState with a value
AsyncDataRefreshing <T >
A loading state with a value. Signals the query conditions that led to the data
has remained the same and is being refreshed
AsyncDataReloading <T >
A loading state with a value. Signals the query conditions that led to the data
has changed and is being reloaded.
AsyncError <T >
State for an AsyncState with an error
AsyncErrorRefreshing <T >
A loading state with an error. Signal the query conditions that led to the error
has remained the same and is being refreshed.
AsyncErrorReloading <T >
A loading state with an error. Signal the query conditions that led to the error
has changed and is being reloaded.
AsyncLoading <T >
State for an AsyncState with a loading state
AsyncSignal <T >
The signal function creates a new signal. A signal is a container for a value that can change over time. You can read a signal's value or subscribe to value updates by accessing its .value property.
AsyncState <T >
AsyncState is class commonly used with Future/Stream signals to represent the states the signal can be in.
ChangeStackSignal <T >
Change stack signal that can be used to call undo/redo on a value.
Computed <T >
Data is often derived from other pieces of existing data. The computed function lets you combine the values of multiple signals into a new signal that can be reacted to, or even used by additional computeds. When the signals accessed from within a computed callback change, the computed callback is re-executed and its new return value becomes the computed signal's value.
Connect <T , S extends T >
The idea for connect comes from Anguar Signals with RxJS:
DevToolsSignalsObserver
Signals DevTools observer
Effect
The effect function is the last piece that makes everything reactive. When you access a signal inside its callback function, that signal and every dependency of said signal will be activated and subscribed to. In that regard it is very similar to computed(fn) . By default all updates are lazy, so nothing will update until you access a signal inside effect.
EventSinkSignalMixin <T >
EventSink implementation for AsyncState
FutureSignal <T >
Future signals can be created by extension or method.
IterableSignal <E >
A Signal that holds a Iterable .
IterableSignalMixin <E , T extends Iterable <E > >
ListSignal <E >
A Signal that holds a List .
ListSignalMixin <E , T extends List <E > >
LoggingSignalsObserver
Logs all signals and computed changes to the console.
MapSignal <K , V >
A Signal that holds a Map .
MapSignalMixin <K , V , T extends Map <K , V > >
PersistedBoolSignal
A PersistedSignal that stores a boolean value.
PersistedDoubleSignal
A PersistedSignal that stores an double value.
PersistedEnumSignal <T extends Enum >
A PersistedSignal that stores an enum value.
PersistedIntSignal
A PersistedSignal that stores an integer value.
PersistedNullableBoolSignal
A PersistedSignal that stores a nullable string value.
PersistedNullableDoubleSignal
A PersistedSignal that stores a nullable double value.
PersistedNullableEnumSignal <T extends Enum >
A PersistedSignal that stores a nullable enum value.
PersistedNullableIntSignal
A PersistedSignal that stores a nullable integer value.
PersistedNullableNumSignal
A PersistedSignal that stores a nullable numeric value.
PersistedNullableStringSignal
A PersistedSignal that stores a nullable string value.
PersistedNumSignal
A PersistedSignal that stores a numeric value.
PersistedSignal <T >
A signal that persists its value in a key-value store.
PersistedStringSignal
A PersistedSignal that stores a string value.
QueueSignal <T >
A Signal that holds a Queue .
QueueSignalMixin <T , S extends Queue <T > >
ReadonlySignal <T >
Read only signals can just retrieve a value but not update or cause mutations
SetSignal <E >
A Signal that holds a Set .
SetSignalMixin <E , T extends Set <E > >
Signal <T >
Simple writeable signal
SignalContainer <T , Arg , S extends ReadonlySignalMixin <T > >
Signal container used to create signals based on args
SignalsInMemoryKeyValueStore
An in-memory implementation of SignalsKeyValueStore.
SignalsKeyValueStore
An abstract class that defines the contract for a key-value store
to be used with PersistedSignal.
SignalsObserver
You can observe all signal values in the dart application by providing an implementation of SignalsObserver:
SinkSignalMixin <T >
Sink implementation for Signal
StreamSignal <T >
Stream signals can be created by extension or method.
StreamSignalMixin <T >
TimerSignal
Emit recurring TimerSignalEvent aka AsyncSignal
TrackedSignal <T >
A signal that stores the initial and previous value
Functions
asyncSignal <T > (AsyncState <T > value , {String ? debugLabel , bool autoDispose = false })
→ AsyncSignal <T >
The signal function creates a new signal. A signal is a container for a value that can change over time. You can read a signal's value or subscribe to value updates by accessing its .value property.
batch <T > (BatchCallback <T > fn )
→ T
The batch function allows you to combine multiple signal writes into one single update that is triggered at the end when the callback completes.
changeStack <T > (T value , {String ? debugLabel , int ? limit , bool autoDispose = false })
→ ChangeStackSignal <T >
Change stack signal that can be used to call undo/redo on a value.
computed <T > (T compute (), {String ? debugLabel , bool autoDispose = false , bool runCallbackOnListen = false })
→ FlutterComputed <T >
Create a new signal that is computed based on the values of other signals.
computedAsync <T > (Future <T > fn (), {T? initialValue , String ? debugLabel , bool autoDispose = false , List <ReadonlySignal > dependencies = const [] , bool lazy = true })
→ FutureSignal <T >
Async Computed is syntax sugar around FutureSignal .
computedFrom <T , A > (List <ReadonlySignal <A > > signals , Future <T > fn (List <A > args ), {T? initialValue , String ? debugLabel , bool autoDispose = false , bool lazy = true })
→ FutureSignal <T >
Async Computed is syntax sugar around FutureSignal .
connect <T , S extends T > (Signal <T > signal , [Stream <S > ? stream ])
→ Connect <T , S >
The idea for connect comes from Anguar Signals with RxJS:
disableSignalsDevTools ()
→ void
Disable the devtools
effect (EffectCallback fn , {String ? debugLabel , EffectCallback ? onDispose })
→ EffectCleanup
The effect function is the last piece that makes everything reactive. When you access a signal inside its callback function, that signal and every dependency of said signal will be activated and subscribed to. In that regard it is very similar to computed(fn) . By default all updates are lazy, so nothing will update until you access a signal inside effect.
futureSignal <T > (Future <T > fn (), {T? initialValue , String ? debugLabel , List <ReadonlySignal > dependencies = const [] , bool lazy = true , bool autoDispose = false })
→ FutureSignal <T >
Future signals can be created by extension or method.
iterableSignal <T > (Iterable <T > iterable , {String ? debugLabel , bool autoDispose = false })
→ IterableSignal <T >
Create an IterableSignal from Iterable
lazySignal <T > ({String ? debugLabel , bool autoDispose = false , bool runCallbackOnListen = false })
→ FlutterSignal <T >
Lazy signal that can be created with type T that
the value will be assigned later.
listSignal <T > (List <T > list , {String ? debugLabel , bool autoDispose = false })
→ ListSignal <T >
Create an ListSignal from List
mapSignal <K , V > (Map <K , V > map , {String ? debugLabel , bool autoDispose = false })
→ MapSignal <K , V >
Create an MapSignal from Map
queueSignal <T > (Queue <T > list , {String ? debugLabel , bool autoDispose = false })
→ QueueSignal <T >
Create an QueueSignal from Queue
readonly <T > (T value , {String ? debugLabel , bool autoDispose = false , bool runCallbackOnListen = false })
→ FlutterReadonlySignal <T >
Create a new plain readonly signal
readonlySignalContainer <T , Arg > (ReadonlySignal <T > create (Arg ), {bool cache = false })
→ SignalContainer <T , Arg , ReadonlySignal <T > >
Create a signal container used to instance signals based on args
reloadSignalsDevTools ()
→ void
Reload the devtools
setSignal <T > (Set <T > list , {String ? debugLabel , bool autoDispose = false })
→ SetSignal <T >
Create an SetSignal from Set
signal <T > (T value , {String ? debugLabel , bool autoDispose = false , bool runCallbackOnListen = false })
→ FlutterSignal <T >
Simple signal that can be created with type T that
can read and write a value.
signalContainer <T , Arg > (Signal <T > create (Arg ), {bool cache = false })
→ SignalContainer <T , Arg , Signal <T > >
Create a signal container used to instance signals based on args
streamSignal <T > (Stream <T > callback (), {T? initialValue , String ? debugLabel , List <ReadonlySignal > dependencies = const [] , void onDone ()?, bool ? cancelOnError , bool lazy = true , bool autoDispose = false })
→ StreamSignal <T >
Stream signals can be created by extension or method.
timerSignal (Duration every , {String debugLabel = 'Timer' , bool ? cancelOnError , bool autoDispose = false })
→ TimerSignal
Create a TimerSignal
trackedSignal <T > (T value , {String ? debugLabel , bool autoDispose = false })
→ TrackedSignal <T >
Create a signal that stores the initial and previous value
untracked <T > (UntrackedCallback <T > fn )
→ T
In case when you're receiving a callback that can read some signals, but you don't want to subscribe to them, you can use untracked to prevent any subscriptions from happening.