StreamBuilder snapshot is always ConnectionState.waiting

前端 未结 5 2016
故里飘歌
故里飘歌 2021-02-19 12:12

I thought I understood StreamBuilders but I have some doubts that are puzzling me.

I thought that a ConnectionState.waiting means that the connection with the stream is

5条回答
  •  独厮守ぢ
    2021-02-19 12:41

    I use a stream variable otherwise I would have the same error

     Stream>> friendUser;
      @override
      Widget build(BuildContext context) {
        final
         db = Provider.of(context, listen: false);
        friendUser = StreamZip([db.usersStream1(), db.usersStream2()]);
       return Scaffold(
       ...
          StreamBuilder>>(
                          stream: friendUser,
                          //qui ont deja discuter
                          initialData: [],
                          builder: (context, snapshot) {...}),
    
       );
    
    }
    

提交回复
热议问题