flutter_stream_listener
2.0.0, released 5 years ago by felangel.dev
Flutter widget that manages stream subscriptions and exposes callbacks.
WASM-ready
What it does
The package provides a StreamListener widget which manages a subscription to a Stream and exposes callbacks like onData, onError, and onDone. It reduces the complexity of manually subscribing to streams and canceling subscriptions.
AI-written summary of version 2.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to react to stream events directly in the widget tree.
- You want to automatically handle stream subscription cancellation.
Skip it when
- You need non-widget based stream controllers or business logic management.
- You are already using state management solutions that handle streams natively.
Strengths
- Simplifies stream subscription lifecycle management inside widgets.
- Exposes standard callbacks including onData, onError, and onDone.
Weaknesses
- Very limited scope focusing only on a single StreamListener widget.
- Not documented beyond basic usage.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
No special setup or native configuration required.
StreamListener<int>(
stream: Stream.fromIterable([0, 1, 2, 3]),
onData: (data) {
// React to the emitted data
},
child: const SizedBox(),
)Alternatives
Packages that do the same job and could replace flutter_stream_listener.
- disposebag
Utility to collect and dispose StreamSubscriptions and Sinks in Dart/Flutter.
50Compare