parentStorePlugin

inline fun <S : MVIState, I : MVIIntent, A : MVIAction, S2 : MVIState, I2 : MVIIntent, A2 : MVIAction> parentStorePlugin(parent: Store<S2, I2, A2>, name: String? = parent.name?.let { "ParentStorePlugin\$$it" }, minExternalSubscriptions: Int = 1, crossinline consume: suspend PipelineContext<S, I, A>.(action: A2) -> Unit, crossinline render: suspend PipelineContext<S, I, A>.(state: S2) -> Unit): StorePlugin<S, I, A>

An overload of the parentStorePlugin that also consumes its MVIActions. Please see the other overload for more documentation.

See also


inline fun <S : MVIState, I : MVIIntent, A : MVIAction, S2 : MVIState, I2 : MVIIntent> parentStorePlugin(parent: Store<S2, I2, *>, name: String? = parent.name?.let { "ParentStorePlugin\$$it" }, minExternalSubscriptions: Int = 1, crossinline render: suspend PipelineContext<S, I, A>.(state: S2) -> Unit): StorePlugin<S, I, A>

Deprecated

Parent store plugin introduces unnecessary complexity to the behavior and has little flexibility. Subscribe to the store in some other plugin instead, such as whileSubscribedPlugin using a suspending function collect()

Replace with

import pro.respawn.flowmvi.plugins.whileSubscribedPlugin
import pro.respawn.flowmvi.dsl.collect
whileSubscribedPlugin { parent.collect { } }

Creates and installs a new plugin that will subscribe to the parent store at the same time the current store is subscribed to and when minExternalSubscriptions are reached.

This plugin will subscribe to the parent store and render its states while there are minExternalSubscriptions of the current store present. When the subscribers leave as in whileSubscribedPlugin, this store will also unsubscribe from the parent store.

Essentially, this store will be a subscriber of another store while this store is also subscribed to externally. For the behavior where the store will always be subscribed, please subscribe in the initPlugin.

This function will not consume MVIActions of the parent store. For that, please see the other overload of this function.

The name of this plugin will be derived from the parent store's name, if present, otherwise null.

See also