take

fun <T> Flow<T>.take(count: Int): Flow<T>(source)

Returns a flow that contains first count elements. When count elements are consumed, the original flow is cancelled. Throws IllegalArgumentException if count is not positive.