ConflatedBroadcastChannel

Deprecated

ConflatedBroadcastChannel is deprecated in the favour of SharedFlow and is no longer supported

Broadcasts the most recently sent element (aka value) to all openSubscription subscribers.

Back-to-send sent elements are conflated -- only the most recently sent value is received, while previously sent elements are lost. Every subscriber immediately receives the most recently sent element. Sender to this broadcast channel never suspends and trySend always succeeds.

A secondary constructor can be used to create an instance of this class that already holds a value. This channel is also created by BroadcastChannel(Channel.CONFLATED) factory function invocation.

In this implementation, opening and closing subscription takes linear time in the number of subscribers.

Note: This API is obsolete since 1.5.0 and deprecated for removal since 1.7.0 It is replaced with SharedFlow.

Constructors

Link copied to clipboard
constructor()
constructor(value: E)

Creates an instance of this class that already holds a value.

Properties

Link copied to clipboard
val value: E

The most recently sent element to this channel.

Link copied to clipboard

The most recently sent element to this channel or null when this class is constructed without initial value and no value was sent yet or if it was closed.