async_value_notifier 1.1.0 copy "async_value_notifier: ^1.1.0" to clipboard
async_value_notifier: ^1.1.0 copied to clipboard

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.

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.

0
likes
160
points
158
downloads

Publisher

unverified uploader

Weekly Downloads

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.

Repository (GitHub)
View/report issues

Topics

#async #notifier #batching #tweak #performance

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on async_value_notifier