flatten

fun StateFlow<Map<RoomId, StateFlow<Room?>>>.flatten(throttle: Duration = 200.milliseconds, filterUpgradedRooms: Boolean = true): Flow<Set<Room>>

This collects all rooms, so when one changes, a new set gets emitted. A change of the outer flow results in new collect of the inner flows. Because this is an expensive operation, the outer flow is throttled by default.


fun StateFlow<Map<String, StateFlow<RoomOutboxMessage<*>?>>>.flatten(throttle: Duration = 200.milliseconds): Flow<Set<RoomOutboxMessage<*>>>

This collects all outbox messages, so when one changes, a new set gets emitted. A change of the outer flow results in new collect of the inner flows. Because this is an expensive operation, the outer flow is throttled by default.