ImmutableStore

A Store that does not allow sending intents.

See also

Inheritors

Properties

Link copied to clipboard
abstract val isActive: Boolean

Whether the Store is active (store is started or being started).

Link copied to clipboard
abstract val isStarted: Boolean

Whether the Store has started fully.

Link copied to clipboard
abstract val name: String?

The name of the store. Used for debugging purposes and when storing multiple stores in a collection. Optional and configured through a pro.respawn.flowmvi.dsl.StoreBuilder

Link copied to clipboard

Obtain the current state in an unsafe manner.

Link copied to clipboard
abstract override val states: StateFlow<S>

A flow of states to be rendered by the subscriber.

Functions

Link copied to clipboard
abstract suspend fun awaitStartup()

Wait while the Store is started. If it is already started, returns immediately.

Link copied to clipboard
abstract suspend fun awaitUntilClosed()

Suspend until the store is closed

Link copied to clipboard
inline suspend fun <S : MVIState, I : MVIIntent, A : MVIAction> ImmutableStore<S, I, A>.collect(crossinline consume: suspend Provider<S, I, A>.() -> Unit)

Subscribe to this store and suspend until consume finishes (which should never return). This means the function will suspend forever.

Link copied to clipboard
abstract operator override fun equals(other: Any?): Boolean
Link copied to clipboard
abstract override fun hashCode(): Int
Link copied to clipboard
abstract fun start(scope: CoroutineScope): ImmutableStoreLifecycle

Starts store intent processing in a new coroutine in the given scope. Intents are processed as long as the parent scope is active.

Link copied to clipboard
abstract fun CoroutineScope.subscribe(block: suspend Provider<S, I, A>.() -> Unit): Job

Subscribe to the store, obtaining a Provider to consume MVIStates and MVIActions. The store itself does not expose actions or states to prevent subscribers from affecting the store and to keep track of each subscription. When subscribe is invoked, a new StorePlugin.onSubscribe event is sent to all plugins with the new subscriber count. For more, see StorePlugin.