📱 Flutter Intermediate

What is StreamBuilder in Flutter?

Why Interviewers Ask This

Candidates at the intermediate level are expected to not only know this concept but explain the trade-offs involved. Interviewers use this question to see if you can reason about design decisions, not just recall facts.

Answer

StreamBuilder is a widget that rebuilds its UI whenever the subscribed Stream emits a new event. It is essential for reactive UI — when the stream emits data, error, or completes, the builder receives an updated AsyncSnapshot and rebuilds. Common use cases include real-time data from Firebase Firestore, WebSocket connections, and Bluetooth device events. Unlike FutureBuilder, streams can emit multiple values over time. StreamBuilder automatically subscribes and unsubscribes from the stream.

Common Mistake

Don't just define the term — demonstrate that you understand when to use it and when not to. Showing awareness of trade-offs is what separates average from strong Flutter candidates.