windowed

fun <T> Flow<T>.windowed(size: Int, step: Int = 1): Flow<List<T>>

Emits sliding windows of size elements, advancing by step elements between windows.

A window is emitted only when it is full; a trailing partial window is dropped. When step is greater than size, the elements between windows are skipped.

Throws

if size or step is less than 1.