Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter StreamBuilder only for ListView and GridView?

Tags:

flutter

Is there any case possible using StreamBuilder for other widgets other than ListView and GridView...?

Let's say ChoiceChip? Why ChoiceChip doesn't have builder?

like image 477
stuckedoverflow Avatar asked Jun 23 '26 08:06

stuckedoverflow


1 Answers

Yes. we can use any other widget with Stream see official docs

StreamBuilder(
    stream: bloc.allMovies,
    builder: (context, AsyncSnapshot<ItemModel> snapshot) {
      if (snapshot.hasData) {
        return Text("data incoming");
      } else if (snapshot.hasError) {
        return Text(snapshot.error.toString());
      }
      return Center(child: CircularProgressIndicator());
    },
  )

 

like image 142
Benjith Kizhisseri Avatar answered Jun 25 '26 21:06

Benjith Kizhisseri



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!