repeat

Returns a Flow that repeats all values emitted by the original Flow indefinitely.

Note: If the source Flow is completed synchronously immediately (e.g. emptyFlow), this will cause an infinite loop.


fun <T> Flow<T>.repeat(delay: suspend (count: Int) -> Duration): Flow<T>(source)

Returns a Flow that repeats all values emitted by the original Flow indefinitely, with a delay computed by delay function between each repetition.

Note: If the source Flow is completed synchronously immediately (e.g. emptyFlow), and delay returns Duration.ZERO or a negative value, this will cause an infinite loop.


Returns a Flow that repeats all values emitted by the original Flow indefinitely, with a fixed delay between each repetition.

Note: If the source Flow is completed synchronously immediately (e.g. emptyFlow), and delay is Duration.ZERO, this will cause an infinite loop.


Returns a Flow that repeats all values emitted by the original Flow at most count times. If count is zero or negative, the resulting Flow completes immediately without emitting any items (i.e. emptyFlow).


fun <T> Flow<T>.repeat(count: Int, delay: suspend (count: Int) -> Duration): Flow<T>(source)

Returns a Flow that repeats all values emitted by the original Flow at most count times, with a delay computed by delay function between each repetition.

If count is zero or negative, the resulting Flow completes immediately without emitting any items (i.e. emptyFlow).


fun <T> Flow<T>.repeat(count: Int, delay: Duration): Flow<T>(source)

Returns a Flow that repeats all values emitted by the original Flow indefinitely, with a fixed delay between each repetition.

If count is zero or negative, the resulting Flow completes immediately without emitting any items (i.e. emptyFlow).