What does the note > Note that the latest eleme...
# coroutines
h
What does the note
Note that the latest element is not emitted if it does not fit into the sampling window.
mean in the documentation of
Flow.sample
? https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/sample.html How can an element not fit in a sampling window? There will always be the next window, right? Unless the sampling is cancelled while there are un-emitted events in the latest window, but are there other situations where the latest event is not emitted?
u
I would say the last element is dropped if the stream terminates before the end of the sampling window. I.e. partial windows do not emit
h
That's how I interpret it as well, and how you put it would indeed be a better way to document it.