StoreDelegate

class StoreDelegate<S : MVIState, I : MVIIntent, A : MVIAction>(delegate: Store<S, I, A>, mode: DelegationMode = DelegationMode.Default) : ReadOnlyProperty<Any?, Flow<S>>

An object that provides access to the state of the delegate store. Can be used with the pro.respawn.flowmvi.plugins.delegate.delegate Store dsl to obtain the state projection:

val store = store {
val feedState by delegate(feedStore) {
// handle actions
}
whileSubscribed {
feedState.collect { state ->
// use projection.
}
}
}

The StoreDelegate is responsible for projecting the state of the delegate store to the principal store and optionally handling actions from the delegate store.

Warning: stateProjection is not guaranteed to be up-to-date. See DelegationMode for more details.

See also

Constructors

Link copied to clipboard
constructor(delegate: Store<S, I, A>, mode: DelegationMode = DelegationMode.Default)

Properties

Link copied to clipboard
val name: String?

The name of this delegate, derived from the delegate store's name.

Link copied to clipboard
val stateProjection: Flow<S>

A flow that projects the state of the delegate store based on the delegation mode.

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open operator override fun getValue(thisRef: Any?, property: KProperty<*>): Flow<S>
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toString(): String