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.
}
}
}
Content copied to clipboard
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.