handleAndEmit

open fun <A, E> handleAndEmit(errorHandler: ErrorHandler<T> = ::errorHandler, execute: suspend FlowCollector<E>.(T, A) -> T): EmittingHandler<A, E>

Factory method to create a EmittingHandler taking an action-value and the current store value to derive the new value. An EmittingHandler is a Flow by itself and can therefore be connected to other SimpleHandlers even in other Stores.

Parameters

errorHandler

handles error during update

execute

lambda that is executed for each action-value on the connected Flow. You can emit values from this lambda.

open fun <E> handleAndEmit(errorHandler: ErrorHandler<T> = ::errorHandler, execute: suspend FlowCollector<E>.(T) -> T): EmittingHandler<Unit, E>

factory method to create an EmittingHandler that does not take an action in it's execute-lambda.

Parameters

errorHandler

handles error during update

execute

lambda that is executed for each event on the connected Flow. You can emit values from this lambda.