Bad state: Stream has already been listened to Flutter / Dart Origin: On your device Last updated 4 Nov 2026

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.

Exact message you may see 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
Seen on: Flutter

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

  1. Use StreamController.broadcast()
  2. Create the stream once in initState and reuse it
  3. Prefer ValueNotifier/Riverpod for shared state

Detailed fix by platform

Dart

  1. final controller = StreamController<int>.broadcast();

How to diagnose

  1. Listeners — How many?
  2. Controller — Broadcast?
  3. 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:

Where this error sits

Origin: On your device. Errors that are often confused with or caused by this one (click to open):

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 (Flutter / Dart)A Ticker was active w…Bad state: No element — Dart: Bad state: No element — .first, .last or .single on an empty list (Flutter / Dart)Bad state: No elementError: Couldn't resolve the package — Dart: Error: Couldn't resolve the package 'x' in 'package:x/x.dart' (Flutter / Dart)Error: Couldn't resol…FormatException: Unexpected character — Dart: FormatException: Unexpected character (at character 1) <!DOCTYPE html> — jsonDecode of an HTML page (Flutter / Dart)FormatException: Unex…Illegal argument in isolate message: object is unsendable — Dart: Invalid argument(s): Illegal argument in isolate message: object is unsendable - Library:'dart:async' Class: _Future@4048458 (Flutter / Dart)Illegal argument in i…setState() or markNeedsBuild() called during build — Flutter: setState() or markNeedsBuild() called during build. This widget cannot be marked as needing to build because the framework is already in the process of building widgets (Flutter / Dart)setState() or markNee…The argument type can't be assigned to the parameter type — Dart: The argument type 'String?' can't be assigned to the parameter type 'String' (Flutter / Dart)The argument type can…The getter/method isn't defined for the type — Dart: The getter 'name' isn't defined for the type 'User' / The method 'foo' isn't defined for the class (Flutter / Dart)The getter/method isn…Bad state…

Explore the map of this error Full error map →

🧠 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.