EmittingHandler

class EmittingHandler<A, E>(val collectWithChannel: (Flow<A>, FlowCollector<E>, Job) -> Unit, flow: MutableSharedFlow<E> = MutableSharedFlow()) : Handler<A> , Flow<E>

An EmittingHandler is a special Handler that constitutes a new Flow by itself. You can emit values to this Flow from your code and connect it to other Handlers on this or on other Stores. This way inter-store-communication is done in fritz2.

Parameters

collectWithChannel

defines how to handle the values of the connected Flow

Constructors

Link copied to clipboard
constructor(collectWithChannel: (Flow<A>, FlowCollector<E>, Job) -> Unit, flow: MutableSharedFlow<E> = MutableSharedFlow())

Properties

Link copied to clipboard
Link copied to clipboard
val Flow<MessageEvent>.blob: Flow<Blob>

gives the MessageEvent.data as Flow of Blob

Link copied to clipboard
val Flow<MessageEvent>.body: Flow<String>

gives the MessageEvent.data as Flow of String

Link copied to clipboard
val collectWithChannel: (Flow<A>, FlowCollector<E>, Job) -> Unit
Link copied to clipboard
val Flow<MessageEvent>.data: Flow<Any?>

gives the MessageEvent.data as Flow of Any

Link copied to clipboard
open override val process: (Flow<A>, Job) -> Unit

function defining how this Handler collects a Flow when connected using handledBy

Link copied to clipboard
val <M : ValidationMessage> Flow<List<M>>.valid: Flow<Boolean>

Checks if a Flow of a List of ValidationMessages is valid.

Functions

Link copied to clipboard
open suspend override fun collect(collector: FlowCollector<E>)
Link copied to clipboard
open operator fun invoke(data: A)

Calls this handler exactly once.

Link copied to clipboard
operator fun Handler<Unit>.invoke()

Calls this handler exactly once.

Link copied to clipboard
fun <T> Flow<T>.whenever(condition: Flow<Boolean>): Flow<T?>

This extension method takes a boolean Flow that controls the forwarding of an initial flow: If it is true the current value will be passed further on the result flow, if it is false a null will appear instead.