takeWhileInclusive

fun <T> Flow<T>.takeWhileInclusive(predicate: suspend (T) -> Boolean): Flow<T>

Emits values while predicate returns true, including the first value for which it returns false.

Unlike takeWhile, the value that terminates the flow is emitted before completion. The upstream is cancelled once the predicate fails.