asFlow
@FlowPreview fun <T> BroadcastChannel<T>.asFlow(): Flow<T>
(source)Represents the given broadcast channel as a hot flow. Every flow collector will trigger a new broadcast channel subscription.
Cancellation semantics
- Flow consumer is cancelled when the original channel is cancelled.
- Flow consumer completes normally when the original channel completes (~is closed) normally.
- If the flow consumer fails with an exception, subscription is cancelled.