📱 Flutter Intermediate

What is StreamBuilder in Flutter?

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.