BroadcastChannel
Creates a broadcast channel with the specified buffer capacity.
The resulting channel type depends on the specified capacity parameter:
when
capacitypositive, but less than UNLIMITED -- createsArrayBroadcastChannelwith a buffer of given capacity. Note: this channel looses all items that are send to it until the first subscriber appears;when
capacityis CONFLATED -- creates ConflatedBroadcastChannel that conflates back-to-back sends;when
capacityis BUFFERED -- createsArrayBroadcastChannelwith a default capacity.otherwise -- throws IllegalArgumentException.
Note: This API is obsolete since 1.5.0. It will be deprecated with warning in 1.6.0 and with error in 1.7.0. It is replaced with StateFlow and SharedFlow.