collect

suspend fun <T> Subscribable<T>.collect(collector: FlowCollector<T>)

Collects all emissions from this Subscribable by converting it to a Flow and collecting with the given collector.

This is a convenience equivalent to subscribable.asFlow().collect(collector).

Suspends until the Subscribable calls Observer.onComplete or the calling coroutine is canceled. On cancellation the underlying subscription is disposed automatically.

Parameters

collector

The FlowCollector to receive each emitted value.