takeUntil

fun <T> Flow<T>.takeUntil(notifier: Flow<Any?>): Flow<T>(source)

Emits the values emitted by the source Flow until a notifier emits a value or completes.

Parameters

notifier

The Flow whose first emitted value or complete event will cause the output Flow of takeUntil to stop emitting values from the source Flow.