About

AsyncValueNotifier is an asynchronous variant of ValueNotifier that coalesces multiple value assignments within the same event‑loop turn into a single notification dispatched in a later microtask.

Key benefits:

  • Avoids synchronous listener re‑entrancy corrupting sequential logic.
  • Prevents common Flutter "setState()/markNeedsBuild during build" style exceptions by deferring callbacks until after the current stack unwinds.
  • Optionally cancels notification if value reverted during the same event loop turn.
  • Optionally ignores duplicate listeners while triggering.
  • Supports weak-referenced listeners (to avoid memory leaks).
  • Supports custom equality checks.

Installation

  1. Run the following command in your project directory:
flutter pub add async_value_notifier
  1. Add the following code to your dart file:
import 'package:async_value_notifier/async_value_notifier.dart';

Usage

Almost the same as ValueNotifier while using the default configuration. For more information, please check example or API reference.