collect

abstract suspend override fun collect(collector: FlowCollector<T>): Nothing

Accepts the given collector and emits values into it. This method should never be used directly. To emit values from a shared flow into a specific collector, either collector.emitAll(flow) or collect { ... } extension should be used.

A shared flow never completes. A call to Flow.collect or any other terminal operator on a shared flow never completes normally.

See also

Sources

common source
Link copied to clipboard