async_value_notifier 1.0.2
async_value_notifier: ^1.0.2 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 suppresses "undo" changes (value changed then restored) and optionally ignores duplicate listener registrations.
Installation #
- Run the following command in your project directory:
flutter pub add async_value_notifier
- Add the following code to your dart file:
import 'package:async_value_notifier/async_value_notifier.dart';
Usage #
Almost the same as ValueNotifier
. For more information, please check example or API reference.