nucleus library

Classes

Atom<T>
The base class for all atoms.
AtomConfigMixin<A extends Atom>
AtomContext<T>
Passed to the Atom.$read method, allowing you to interact with other atoms and manage the lifecycle of your state.
AtomInitialValue<A>
Returned from Atom.withInitialValue for passing to a AtomRegistry or AtomScope.
AtomRegistry
Responsible for mapping atom's to their state.
AtomWithParent<A, Parent extends Atom>
AtomWithParentBase<A, Parent extends Atom>
See atomWithParent.
FutureData<A>
Represents the case where an async operation succeeds, and has returned a some data.
FutureError<A>
Represents the case where an async operation fails, and has returned an error.
FutureLoading<A>
Represents the case where an async operation is waiting for a result.
FutureValue<A>
Represents the loading, error and data state of an async operation.
MemoryNucleusStorage
NucleusStorage
ReadOnlyAtom<T>
See atom.
ReadOnlyAtomBase<Value>
See atom.
RefreshableAtomWithParent<A, Parent extends Atom>
See atomWithParent.
RefreshableReadOnlyAtom<T>
See atom.
RefreshableWritableAtom<R, W>
Represents an Atom that can be written to.
StateAtom<R>
Represents an Atom that can be written to.
WritableAtom<R, W>
Represents an Atom that can be written to.
WritableAtomBase<R, W>
Represents an Atom that can be written to.

Functions

atom<Value>(AtomReader<Value> create) ReadOnlyAtom<Value>
Create a read only atom that can interact with other atom's to create derived state.
atomFamily<A extends Atom, Arg>(A create(Arg arg)) → A Function(Arg arg)
Create a family factory function, for indexing similar atoms with the Arg type.
atomIdMap<T, Id, A extends Atom<T>>(A create(T item), {required Id id(T item)}) Map<Id, A> Function(Iterable<T> items)
atomWithParent<A, Parent extends Atom>(Parent parent, A create(AtomContext<A> get, Parent parent)) AtomWithParent<A, Parent>
Create an Atom that is linked to a parent Atom.
atomWithStorage<R, A>(AtomWithStorageCreate<R, A> create, {required String key, required Atom<NucleusStorage> storage, required A fromJson(dynamic json), required dynamic toJson(A a)}) ReadOnlyAtom<R>
Create an atom that can read and write to a NucleusStorage instance.
futureAtom<A>(AtomReader<Future<A>> create) FutureAtom<A>
Create an AtomWithParent that returns a FutureValue representing the current state of the Future's execution.
stateAtom<Value>(Value initialValue) WritableAtom<Value, Value>
Create a simple atom with mutable state.
stateAtomWithStorage<A>(A initialValue, {required Atom<NucleusStorage> storage, required String key, required A fromJson(dynamic json), required dynamic toJson(A a)}) WritableAtom<A, A>
Create a stateAtom, except it's value is persisted to a NucleusStorage instance.
streamAtom<A>(AtomReader<Stream<A>> create, {A? initialValue}) StreamAtom<A>
weakAtomFamily<A extends Atom, Arg>(A create(Arg arg)) → A Function(Arg arg)
Alternate version of atomFamily that holds a weak reference to each child.
writableAtom<R, W>(AtomReader<R> reader, AtomWriter<R, W> writer) WritableAtom<R, W>
Creates an WritableAtom that can be used to implement custom write logic.

Typedefs

AtomReader<R> = R Function(AtomContext<R> get)
A function that creates a value from an AtomContext
AtomWithStorageCreate<R, A> = R Function(AtomContext<R> get, A? read(), void write(A value))
AtomWriter<R, W> = void Function(GetAtom get, SetAtom set, SetSelf<R> setSelf, W value)
Represents the writer argument to writableAtom
FutureAtom<A> = AtomWithParent<FutureValue<A>, Atom<Future<A>>>
Represents an AtomWithParent for an async operation.
GetAtom = A Function<A>(Atom<A> atom)
Represents a function that retrieves an Atom's value.
SetAtom = void Function<R, W>(WritableAtom<R, W> atom, W value)
Represents a function that sets a WritableAtom's value.
SetSelf<A> = void Function(A value)
Represents function that sets the current atom's value
StreamAtom<A> = AtomWithParent<FutureValue<A>, Atom<Stream<A>>>
Represents an AtomWithParent for a streaming operation.