So, no .forEach but more like .forLatest... or doe...
# coroutines
r
So, no .forEach but more like .forLatest... or does .forEach not look into the past anyways?
z
Flows are cold by default, which means that there’s no such thing as “past” before collection begins. forEach will see every element emitted by the stream each time it’s collected. For hot streams, such as MutableSharedFlow or ones backed by channels, the items emitted by the steam depend on things like the replay buffer specified on the shared flow, or what items have been sent to the channel and not received before collection begins. ForEach will see whatever gets emitted.
r
@Zach Klippenstein (he/him) [MOD] Thanks, I guess I should use MutableStateFlow instead then.