asp library

Classes

Atom<T>
An Atom represents a microstate for the application.
Anyone can read an Atom, but only an atomAction can modify it.
Being a Listenable, it can be observed traditionally using addListener and removeListener. However, using atomEffect allows you to observe multiple Atoms at once.
AtomAction
An Atom can only be modified within an AtomAction.
This ensures that the state is changed in a safe and predictable manner, allowing state observation.

There are several variations of AtomAction that accept arguments:
AtomAction1<A>
An Atom can only be modified within an AtomAction.
This ensures that the state is changed in a safe and predictable manner, allowing state observation.

There are several variations of AtomAction that accept arguments:
AtomAction2<A1, A2>
An Atom can only be modified within an AtomAction.
This ensures that the state is changed in a safe and predictable manner, allowing state observation.

There are several variations of AtomAction that accept arguments:
AtomAction3<A1, A2, A3>
An Atom can only be modified within an AtomAction.
This ensures that the state is changed in a safe and predictable manner, allowing state observation.

There are several variations of AtomAction that accept arguments:
AtomBuilder
Listen for Atom changes present in the builder method.
builder: All Atom used in this function will be automatically signed and this function will be called every time the value of an Atom changes.
AtomObserver
Listens to changes of all instantiated Atoms in the application.
AtomPipe<T>
A pipe that can be used to transform the value of an Atom.
AtomStatus
Represents the status of an Atom. event: Event of the Atom.
atom: The Atom that has changed.
GetState
Registers a notifier and returns its value.
Hook<R>
A base abstract class for all Hooks. Hooks are reusable logic that can be shared across different parts of the application, encapsulating initialization and disposal logic.
HookState
A mixin to be used with StatefulWidget to enable the use of Hooks. This mixin manages the lifecycle of Hooks, ensuring they are properly initialized and disposed of.
RxDisposer
Remove all listeners of atomEffect.
SetState
Encapsulates the callback to change the state of an Atom.

Enums

AtomEvent
Atom event types.

Extensions

AnimationHookStateExtension on HookState
Extension methods for HookState to handle Animation-based Hooks.
AtomHookExtension on HookState
A set of hooks provided by the hook_state package for ASP.
ControllerHookStateExtension on HookState
Extension methods for HookState to handle various Controller-based Hooks.
ListenableHookStateExtension on HookState
Extension methods for HookState to handle Listenable-based Hooks.
StreamHookStateExtension on HookState
Extension methods for HookState to handle Stream-based Hooks.

Functions

asyncSelector<T>(T state, AsyncSelectorFunction<T> scope, {String? key, List<AtomPipe<T>> pipes = const []}) → Atom<T>
Creates an asynchronous selector Atom that derives its state from other Atoms.
state: The initial state of the Atom.
scope: A function that returns the derived state asynchronously.
key: The identifier of the Atom.
pipe: A function that allows you to manipulate the value of the Atom.
atom<T>(T state, {String? key, List<AtomPipe<T>> pipes = const [], bool distinct = true}) → Atom<T>
An Atom represents a microstate for the application.
Anyone can read an Atom, but only an atomAction can modify it.
Being a Listenable, it can be observed traditionally using Atom.addListener and Atom.removeListener. However, using atomEffect allows you to observe multiple Atoms at once.
atomAction(FutureOr scope(SetState set), {String? key}) → AtomAction
An Atom can only be modified within an AtomAction.
This ensures that the state is changed in a safe and predictable manner, allowing state observation.

There are several variations of AtomAction that accept arguments:
atomAction1<A>(FutureOr scope(SetState set, A action), {String? key}) → AtomAction1<A>
An Atom can only be modified within an AtomAction.
This ensures that the state is changed in a safe and predictable manner, allowing state observation.

There are several variations of AtomAction that accept arguments:
atomAction2<A1, A2>(FutureOr scope(SetState set, A1 arg1, A2 arg2), {String? key}) → AtomAction2<A1, A2>
An Atom can only be modified within an AtomAction.
This ensures that the state is changed in a safe and predictable manner, allowing state observation.

There are several variations of AtomAction that accept arguments:
atomAction3<A1, A2, A3>(FutureOr scope(SetState set, A1 arg1, A2 arg2, A3 arg3), {String? key}) → AtomAction3<A1, A2, A3>
An Atom can only be modified within an AtomAction.
This ensures that the state is changed in a safe and predictable manner, allowing state observation.

There are several variations of AtomAction that accept arguments:
atomEffect<T>(T body(GetState get), {void effect(T value)?}) → RxDisposer
Listen for Atom changes present in the body.
body: All Atoms used in this function will be automatically subscribed and this function will be called every time the value of an Atom changes.
filter: Filter reactions and prevent unwanted effects.
effect: The body function generates a value that can be retrieved from the effect function.
debounceTime<T>([Duration duration = const Duration(milliseconds: 500)]) → AtomPipe<T>
Emits a notification from an Atom only after a specified period of time has passed without another source issuing.
intervalPipe<T>([Duration duration = const Duration(milliseconds: 500)]) → AtomPipe<T>
Emits a notification from an Atom after a given duration.
selector<T>(SelectorFunction<T> scope, {String? key, List<AtomPipe<T>> pipes = const []}) → Atom<T>
Creates a selector Atom that derives its state from other Atoms.
scope: A function that returns the derived state.
key: The identifier of the Atom.
pipe: A function that allows you to manipulate the value of the Atom.
throttleTime<T>([Duration duration = const Duration(milliseconds: 500)]) → AtomPipe<T>
Emits a notification from an Atom, then ignores subsequent source values for duration milliseconds, then repeats this process.

Typedefs

AsyncSelectorFunction<T> = FutureOr<T> Function(GetState get)
Used in Atom.asyncSelector propetie
SelectorFunction<T> = T Function(GetState get)
Used in Atom.selector propetie