listenable_stream
2.0.1, released 2 years ago by an unverified publisher
Convert Flutter Listenable and ValueListenable objects into Dart Streams and ValueStreams.
WASM-ready
What it does
Extends Flutter's Listenable and ValueListenable classes to easily convert them into Dart Streams or RxDart ValueStreams. It enables reactive programming patterns directly from standard change notifiers.
AI-written summary of version 2.0.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to combine ChangeNotifier or ValueNotifier with RxDart stream operators.
- You need to bridge standard Flutter listeners into a stream-based architecture.
Skip it when
- You already use a comprehensive state management framework like Riverpod or Bloc that handles reactivity internally.
- You prefer direct widget rebuilding via AnimatedBuilder rather than stream subscriptions.
Strengths
- Seamless integration between Flutter's built-in Listenable types and RxDart.
- Supports replay value options for ValueListenable streams.
Weaknesses
- Returned streams are single-subscription only.
- Adds an explicit dependency on rxdart.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
final ValueNotifier<int> valueNotifier = ValueNotifier(0);
final ValueListenableStream<int> stream = valueNotifier.toValueStream();
stream.listen(print);Alternatives
Packages that do the same job and could replace listenable_stream.
Works with
Packages commonly used together with listenable_stream: ones it builds on, ones built on it, and its own family.