What does emit.forEach() do? From what I understand, it takes a stream but how does the ui rebuild itself and what is the onData parameter? I want to return a stream of data for a client matrix sdk
on<StartMatrixEventSubmitted>((event, emit) async {
emit(MatrixLoadingState());
await repo.getAllRooms().then((value) async {
await emit.forEach(
value.onSync.stream,
onData: (value2) {
print('data');
return MatrixSuccuClientState(rooms: value.rooms);
},
);
this.myRooms = value.rooms;
emit(MatrixClientSynced());
});
});