flutter broadcast stream example
Example 1: dart StreamController broadcast()
var controller= StreamController.broadcast();
controller.stream.listen(print);
controller.sink.add(1); // will print 1
Example 2: streams flutter
void messagesStream()async{
await for( var snapshot in _firestore.collection('messages').snapshots()){
for (var message in snapshot.documents) {
print(message.data);
};
}
//can be used for chat app