Skip to content
Blog

ValueNotifier in Flutter: One Value, Minimal Boilerplate

Use ValueNotifier and ValueListenableBuilder for single-value state in Flutter with zero ceremony and no external packages.

Published on • November 4, 2026

AI Assistant

When your state is exactly one value, ValueNotifier<T> is the smallest tool that works. It extends ChangeNotifier but only notifies when the value actually changes — no getter boilerplate, no external package.

The pattern

final isLoading = ValueNotifier<bool>(false);

// Somewhere in a build:
ValueListenableBuilder<bool>(
  valueListenable: isLoading,
  builder: (context, value, _) {
    return value
        ? const CircularProgressIndicator()
        : const Text('Ready');
  },
)

Assign to .value to update — notifyListeners() fires only if the new value differs from the old one (using ==).

Common uses

ValueNotifier shines for small, frequent state: scroll offsets, toggle flags, text field contents, animation-adjacent values.

final scrollProgress = ValueNotifier<double>(0);

// In a scroll listener:
scrollProgress.value =
    (controller.position.pixels / controller.position.maxScrollExtent).clamp(0.0, 1.0);

Then feed it to a ValueListenableBuilder to drive a progress bar.

ValueListenableBuilder vs ListenableBuilder

ValueListenableBuilder takes a valueListenable and gives you the value directly in the builder. ListenableBuilder takes any Listenable (including a ValueNotifier) but doesn’t hand you the value — you’d read it from the notifier yourself. For single values, prefer ValueListenableBuilder; it’s more precise and rebuilds only when the value changes.

Grouping with ValueNotifier3

For a handful of related values you can combine them into one object and use ValueListenableBuilder with an equality check, or simply use several notifiers. Resist the urge to build a whole store — if you find yourself needing derived state and actions, graduate to ChangeNotifier or a dedicated package.

Takeaway: ValueNotifier<T> + ValueListenableBuilder is the zero-boilerplate option for single-value state — it only notifies on actual change, so it’s efficient for frequent updates like scroll progress and toggle flags.