Skip to content

effects

Florian Schuster edited this page Nov 14, 2021 · 5 revisions

An EffectController is a Controller that additionally provides a Flow of Effect which represent a one-shot UI notification such as a Toast or a Snackbar on Android.

interface EffectController<Action, State, Effect> : Controller<Action, State> {
    val effects: Flow<Effect>
}

The effects Flow is received in a fan-out fashion, which means one emission can be collected by one collector only.

When creating an EffectController via CoroutineScope.createEffectController, Effects can be emitted from within Mutation-, Reducer- and all Transformer-contexts via emitEffect(Effect)

example

Clone this wiki locally