finds.dev← search

// the find

rrousselGit/state_notifier

★ 313 · Dart · MIT · updated Aug 2023

ValueNotifier, but outside Flutter and with some extra perks

A Flutter-agnostic port of ValueNotifier that enforces immutable state management. It's from Remi Roussel, the author of Riverpod and Provider, and was the recommended state holder pattern before Riverpod's Notifier class made it largely redundant. New Riverpod projects should use Notifier instead.

Separating state logic from Flutter means notifiers are plain Dart objects that test without a widget tree. The `identical` check default is a sensible tradeoff — avoids expensive deep equality on complex state while still filtering primitive duplicates. `updateShouldNotify` override is a clean escape hatch when the default doesn't fit. The Freezed pairing for discriminated union states is genuinely useful and the README shows it clearly.

Last commit August 2023 and 313 stars — this is effectively superseded by Riverpod 2.x's built-in `Notifier`/`AsyncNotifier`, which do the same thing with better tooling and active maintenance. `LocatorMixin` is a footgun: it couples notifiers to a service locator in a way that makes dependency flow hard to follow and test. The package split (state_notifier vs flutter_state_notifier) adds friction for what is a small amount of code — you're managing two pubspec entries for a single concept.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →