solidart_hooks library

A Dart library for Solidart Hooks, providing Flutter Hooks bindings for Solidart.

Classes

Computed<T>
A special Signal that notifies only whenever the selected values change.
DebounceOperation
The operation that must be performed is the callback It will be perfomed when the timer completes and only if the timer has not been cancelled before
Debouncer
A static class for handling method call debouncing.
Effect
Signals are trackable values, but they are only one half of the equation. To complement those are observers that can be updated by those trackable values. An effect is one such observer; it runs a side effect that depends on signals.
ListSignal<T>
ListSignal makes easier interacting with lists in a reactive context.
MapSignal<K, V>
MapSignal makes easier interacting with maps in a reactive context.
ReactiveSystem
ReadableSignal<T>
A read-only Signal.
ReadSignal<T>
A read-only Signal.
Resource<T>
Resources are special Signals designed specifically to handle Async loading. Their purpose is wrap async values in a way that makes them easy to interact with handling the common states of a future data, error and loading.
ResourceError<T>
Creates an ResourceState in error state.
ResourceLoading<T>
Creates an ResourceState in loading state.
ResourceReady<T>
Creates an ResourceState in ready state with a data.
ResourceState<T>
Manages all the different states of a Resource:
SetSignal<T>
SetSignal makes easier interacting with sets in a reactive context.
Show<T extends bool>
Conditionally render its builder or an optional fallback component based on the when evaluation.
Signal<T>
Signals
SignalBase<T>
The base of a signal.
SignalBuilder
Reacts to the signals automatically found in the builder function.
SolidartConfig
The global configuration of the reactive system.
SolidartObserver
An object that listens to the changes of the reactive system.

Enums

DevToolsEventType
The type of the event emitted to the devtools

Mixins

ValueListenableSignalMixin<T>
ValueNotifier implementation for solidart.Signal
ValueNotifierSignalMixin<T>
ValueNotifier implementation for solidart.Signal

Extensions

DevToolsExt on SignalBase<T>
Extension for the devtools
FutureOrThenExtension on FutureOr<T>
Extension to add a then method to FutureOr. This is used internally to handle both Future and synchronous values uniformly.
MayDisposeDependencies on ReactiveNode
ObserveSignal on SignalBase<T>
A callback that is fired when the signal value changes
ResourceExtensions on ResourceState<T>
Some useful extension available on any ResourceState.
SignalToValueNotifier on SignalBase<T>
Converts a SignalBase into a ValueNotifier;
ToggleBoolSignal on Signal<bool>
Adds the toggle method to boolean signals
Until on SignalBase<T>
Extension that adds the until method to SignalBase classes.
ValueNotifierToSignal on ValueNotifier<T>
Converts a ValueNotifier into a Signal;

Properties

reactiveSystem ReactiveSystem
final

Functions

batch<T>(T fn()) → T
Execute a callback that will not side-effect until its top-most batch is completed.
untracked<T>(T callback()) → T
Execute a callback that will not be tracked by the reactive system.
useComputed<T>(T selector(), {String? name, bool? equals, bool? autoDispose = false, bool? trackInDevTools, bool comparator(T? a, T? b) = identical, bool? trackPreviousValue}) Computed<T>
Create a new computed signal
useExistingSignal<T extends ReadSignal>(T value) → T
Bind an existing signal to the hook widget
useListSignal<T>(Iterable<T> initialValue, {String? name, bool? equals, bool? autoDispose = false, bool? trackInDevTools, bool comparator(List<T>? a, List<T>? b) = identical, bool? trackPreviousValue}) ListSignal<T>
{macro list-signal}
useMapSignal<K, V>(Map<K, V> initialValue, {String? name, bool? equals, bool? autoDispose = false, bool? trackInDevTools, bool comparator(Map<K, V>? a, Map<K, V>? b) = identical, bool? trackPreviousValue}) MapSignal<K, V>
{macro map-signal}
useResource<T>(Future<T> fetcher()?, {String? name, bool? equals, bool? autoDispose = false, bool? trackInDevTools, SignalBase? source, bool lazy = true, bool? useRefreshing, bool? trackPreviousState, Duration? debounceDelay}) Resource<T>
{macro resource}
useResourceStream<T>(Stream<T> stream()?, {String? name, bool? equals, bool? autoDispose = false, bool? trackInDevTools, SignalBase? source, bool lazy = true, bool? useRefreshing, bool? trackPreviousState, Duration? debounceDelay}) Resource<T>
{macro resource}
useSetSignal<T>(Iterable<T> initialValue, {String? name, bool? equals, bool? autoDispose = false, bool? trackInDevTools, bool comparator(Set<T>? a, Set<T>? b) = identical, bool? trackPreviousValue}) SetSignal<T>
{macro set-signal}
useSignal<T>(T initialValue, {String? name, bool? equals, bool? autoDispose = false, bool? trackInDevTools, bool comparator(T? a, T? b) = identical, bool? trackPreviousValue}) Signal<T>
{macro signal}
useSolidartEffect(dynamic cb(), {void onError(Object error)?, String? name, Duration? delay, bool? autoDispose, bool? detach, bool? autorun}) → void
Create a signal effect

Typedefs

DisposeEffect = void Function()
Dispose function
DisposeObservation = void Function()
A callback that stops an observation when called

Exceptions / Errors

SolidartCaughtException
This captures the stack trace when user-land code throws an exception
SolidartException
An Exception class to capture Solidart specific exceptions
SolidartReactionException
This exception would be fired when an reaction has a cycle and does not stabilize in ReactiveConfig.maxIterations iterations