Publisher

abstract class Publisher<T>(val scope: CoroutineScope = CoroutineScope(Dispatchers.Main))

Controller which sends messages of type which can be received on the Dart side by EventChannel listeners.

Constructors

Link copied to clipboard
constructor(scope: CoroutineScope = CoroutineScope(Dispatchers.Main))

Properties

Link copied to clipboard
val scope: CoroutineScope

Scope in which the publish function is executed.

Functions

Link copied to clipboard
fun cancel()

Cancel the broadcast.

Link copied to clipboard
suspend fun emit(event: T)

Add events to be broadcast.

Link copied to clipboard
abstract suspend fun publish()

Actual broadcast implementation which should use emit to broadcast messages of type .

Link copied to clipboard
fun receiveBroadcastAndroid(): SharedFlow<T>

Subscribe to the broadcast and receive messages.

Link copied to clipboard

Subscribe to the broadcast and receive messages.