atomly_flutter library

Flutter integration for the atomly atomic state manager.

Adds:

  • AtomScope — the runtime root that holds an AtomStore and exposes it through an InheritedModel with per-aspect rebuilds.
  • BuildContext extensions on every Atom: watch, read, select, set, update, refresh, invalidate, plus when for Atom<AtomValue<T>>.
  • AtomBuilder / AtomAsyncBuilder — single-atom builder widgets.
  • AtomConsumer — multi-atom builder.
  • AtomListener — side-effect-only widget for snackbars, nav, etc.
import 'package:atomly_flutter/atomly_flutter.dart';

final counter = Atom(0);

void main() {
  runApp(const AtomScope(child: MyApp()));
}

class CounterText extends StatelessWidget {
  const CounterText({super.key});

  @override
  Widget build(BuildContext context) {
    return Text('${counter.watch(context)}');
  }
}

Classes

Atom<T>
The single primitive at the heart of atomly.
AtomAsyncBuilder<T>
AtomBuilder for asynchronous atoms (Atom.future / Atom.stream) that exposes the data/loading/error states as named callbacks.
AtomBuilder<T>
Rebuilds builder whenever atom changes.
AtomConsumer
A builder widget that can watch any number of atoms inside a single build call.
AtomData<T>
The async source has produced a value.
AtomError<T>
The async source produced an error.
AtomFamily<Arg, R>
A factory that produces a distinct Atom for every argument value.
AtomListener<T>
Runs onChange every time atom changes — without rebuilding the widget tree.
AtomLoading<T>
The async source is in flight. Carries the previous data forward (if any) for stale-while-revalidate rendering.
AtomObserver
A hook for observing every atom event in a store.
AtomOverride
A replacement of one atom with another inside an AtomStore.
AtomReader
Function type used by atom builders to read other atoms.
AtomScope
The runtime root of an atomly Flutter app.
AtomStore
The runtime that holds atom state.
AtomValue<T>
The runtime state of an asynchronous Atom.
CallbackAtomObserver
A simple observer that delegates to user-supplied callbacks.

Extensions

AtomContextExt on Atom<T>
BuildContext-aware operations on every Atom.
AtomOverrideBuilders on Atom<T>
Type-safe builders for AtomOverride entries.
AtomValueContextExt on Atom<AtomValue<T>>
Convenience extensions on the AtomValue<T> returned from Atom.future / Atom.stream so that callers can write user.when(context, data:, loading:, error:) directly.

Typedefs

AtomWatch = T Function<T>(Atom<T> atom)
Function type passed to AtomConsumer.builder for reading multiple atoms inside a single rebuild.