reduce

suspend fun <S, T : S> Flow<T>.reduce(operation: suspend (S, T) -> S): S

Accumulates value starting with the first element and applying operation to current accumulator value and each element. Throws NoSuchElementException if flow was empty.

Sources

common source
Link copied to clipboard