Dart: Bad state: Stream has already been listened to
A single-subscription stream was listened to twice, for instance by two StreamBuilders or after a rebuild.
Bad state: Stream has already been listened toStateError: Bad state: Stream has already been listened toStream has already been listened toBad state: Cannot add event after closing Meaning
Normal streams from StreamController() allow one listener. Use StreamController.broadcast() or stream.asBroadcastStream() for several listeners, or share state with a BehaviorSubject/ValueNotifier. Create the stream once (in initState), not in build.
Common causes
- Two widgets listening to the same single-subscription stream
- StreamBuilder given a new/old stream on each rebuild
- Listening again after cancel
- Using stream.listen and StreamBuilder together
- Stream created in build
⚡ Quick fix
- Use
StreamController.broadcast() - Create the stream once in initState and reuse it
- Prefer ValueNotifier/Riverpod for shared state
Detailed fix by platform
Dart
final controller = StreamController<int>.broadcast();
How to diagnose
- Listeners — How many?
- Controller — Broadcast?
- Creation — In build?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- A Ticker was active when the State was disposed Flutter: _HomeState#abc(ticker active) was disposed with an active Ticker. State.dispose() implementations must call dispose() on all their AnimationControllers
- Bad state: No element Dart: Bad state: No element — .first, .last or .single on an empty list
- Error: Couldn't resolve the package Dart: Error: Couldn't resolve the package 'x' in 'package:x/x.dart'
Most viewed in Flutter / Dart
- setState() called after dispose() Flutter: setState() called after dispose(): _MyState#1a2b3 (lifecycle state: defunct, not mounted)
- A RenderFlex overflowed Flutter: A RenderFlex overflowed by x pixels on the right/bottom
- Null check operator used on a null value Dart/Flutter: Null check operator used on a null value
Other ways to find it
Where this error sits
Origin: On your device. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 4 Nov 2026