Skip to content
pubscout

nucleus

0.4.1, released 2 years ago by timsmart.co

An atomic dependency and state management toolkit for Dart and Flutter.

WASM-ready
$ flutter pub add nucleus
Source repository

What it does

Nucleus provides an atomic model for managing application state and dependencies. It allows creating simple state atoms, derived atoms, async future/stream atoms, and features built-in support for families and storage persistence.

AI-written summary of version 0.4.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want a lightweight, atomic state management and dependency injection system.
  • You need automatic disposal and lazy initialization of states.
  • You want to easily derive state from other atoms or handle futures/streams reactively.

Skip it when

  • You prefer established massive ecosystem packages like Provider, Riverpod, or Bloc.
  • You want compile-time code generation for atoms.

Strengths

  • Simple and composable API design
  • Built-in support for future, stream, and persisted storage atoms
  • Automatic disposal and lazy loading of atoms

Weaknesses

  • Smaller community and ecosystem compared to Riverpod or Bloc
  • Less documentation for advanced use cases like writableAtom

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0

Simply add flutter_nucleus or nucleus to pubspec.yaml. Wrap your app in AtomScope if using initial values like shared preferences.

final counter = stateAtom(0);

class CounterText extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return AtomBuilder((context, get, child) {
      final count = get(counter);
      return Text(count.toString());
    });
  }
}

Alternatives

Packages that do the same job and could replace nucleus.

  • riverpod

    Riverpod is a more mature and widely adopted atomic state management library with a very similar conceptual model.

  • provider

    Provider is a standard, simple dependency injection and state management solution built on InheritedWidget.

  • bloc

    BLoC provides strict unidirectional data flow and event-driven state management for larger applications.

Works with

Packages commonly used together with nucleus: ones it builds on, ones built on it, and its own family.