PublishSubject

@FlowPreview()
class PublishSubject<T> : AbstractFlow<T> , SubjectAPI<T>

Multicasts items to any number of collectors when they are ready to receive.

Parameters

the element type of the [Flow]

Constructors

PublishSubject
Link copied to clipboard
fun PublishSubject()
the element type of the [Flow]

Functions

collect
Link copied to clipboard
suspend override fun collect(collector: FlowCollector<T>)
collectorCount
Link copied to clipboard
open override fun collectorCount(): Int
Returns the current number of collectors.
collectSafely
Link copied to clipboard
@FlowPreview()
open suspend override fun collectSafely(collector: FlowCollector<T>)
Start collecting signals from this PublishSubject.
complete
Link copied to clipboard
open suspend override fun complete()
Indicate no further items will be emitted
emit
Link copied to clipboard
open suspend override fun emit(value: T)
Emit the value to all current collectors, waiting for each of them to be ready for consuming it.
emitError
Link copied to clipboard
open suspend override fun emitError(ex: Throwable)
Throw an error on the consumer side.
hasCollectors
Link copied to clipboard
open override fun hasCollectors(): Boolean
Returns true if this PublishSubject has any collectors.