Stream inside a Stream using Providers
As a quick fix, maybe try:
final _chatroomInfo = BehaviorSubject<ChatroomModel>();
On a second note:
The code in its current state is hard to read and understand, it's unmaintainable and inefficient. I'm not sure what you are actually trying to do.
It's a bad idea to nest StreamBuilder
s. It will delay the display of the chat list by at least 2 frames, because every StreamBuilder
renders at least one empty frame (data = null).
Listening to a stream and feeding the result into a Subject
will also add delays.
If possible, try to remove all subjects. Instead, use rx operators.
The BLoC should provide a single output stream that provides all the data that is required to render the chat list.