I'm trying to come up with a StateFlow that emits ...
# coroutines
l
I'm trying to come up with a StateFlow that emits values in a regular interval, but can't figure out the right bits. This is what I have:
Copy code
val now: Flow<ZonedDateTime> = MutableStateFlow(clock.now()).transform {
    while (true) {
      emit(clock.now())
      delay(5.seconds)
    }
  }
Sadly
transform()
breaks my StateFlow, converting it to just a Flow.