bufferTimeout

fun <T> Flow<T>.bufferTimeout(size: Int, duration: Long): Flow<List<T>>

Buffered timeout, that will save up entries until a certain size or time limit. See: https://dev.to/psfeng/a-story-of-building-a-custom-flow-operator-buffertimeout-4d95 Eventually Kotlin should supply this natively, but afaict it isn't there at the time of writing https://github.com/Kotlin/kotlinx.coroutines/issues/540

Parameters

size

: After this number of entries, the buffer will be propagated immediately

duration

: The operation will not wait longer for entries than this number (in millis)