AtomRegistry class

Responsible for mapping atom's to their state.

Each atom corresponds to a Node, which contains the current state for that atom.

Constructors

AtomRegistry({List<AtomInitialValue> initialValues = const [], Scheduler? scheduler})

Properties

hashCode int
The hash code for this object.
no setterinherited
nodes Expando<Node>
The state map, where each atom has a corresponding Node.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

get<A>(Atom<A> atom) → A
Retrieve the state for the given Atom, creating or rebuilding it when required.
mount(Atom atom) → void Function()
Listen to an atom, but don't register a handler function.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
refresh(RefreshableAtom atom) → void
Manually recalculate an atom's value.
set<R, W>(WritableAtomBase<R, W> atom, W value) → void
Set the state of a WritableAtom.
stream<A>(Atom<A> atom) Stream<A>
Listen to an atom as a Stream.
subscribe<A>(Atom atom, void handler(A value), {bool fireImmediately = false}) → void Function()
Listen to changes of an atom's state.
subscribeWithPrevious<A>(Atom<A> atom, void handler(A? previous, A value), {bool fireImmediately = false}) → void Function()
Listen to changes of an atom's state, and retrieve the latest value.
toString() String
A string representation of this object.
inherited
use<A>(Atom atom, FutureOr<A> fn()) Future<A>
Listen to an atom, run the given fn (which can return a Future), then remove the listener once the fn is complete.

Operators

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