Provider

An entity that handles MVIIntents, produces actions and manages states. Provider is available when you call Store.subscribe and allows you to consume your states and actions Provider is a:

Properties

Link copied to clipboard
abstract val actions: Flow<A>

A flow of MVIActions to be handled by the subscribers, usually resulting in one-shot events. How actions are distributed depends on ActionShareBehavior.

Link copied to clipboard
abstract val state: S

Obtain the current state in an unsafe manner. This property is not thread-safe and parallel state updates will introduce a race condition when not handled properly. Such race conditions arise when using multiple data streams such as Flows.

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

A flow of states to be handled by the subscriber.

Functions

Link copied to clipboard
abstract suspend fun emit(intent: I)

Alias for intent with one difference - this function will suspend if pro.respawn.flowmvi.dsl.StoreBuilder.onOverflow permits it.

Link copied to clipboard
inline suspend fun <I : MVIIntent> IntentReceiver<I>.emit(vararg intents: I)

Alias for IntentReceiver.emit for multiple intents

Link copied to clipboard
abstract fun intent(intent: I)

Send an intent asynchronously. The intent is sent to the receiver and is placed in a queue. When IntentReceiver is available (e.g. when the Store is started), the intent will be processed. Intents that overflow the buffer will be handled according to the behavior specified in pro.respawn.flowmvi.dsl.StoreBuilder.onOverflow. If the store is not started when an intent is sent, it will wait in the buffer, and will be processed once the store is started.

Link copied to clipboard
inline fun <I : MVIIntent> IntentReceiver<I>.intent(vararg intents: I)

Alias for IntentReceiver.intent for multiple intents

Link copied to clipboard
fun <I : MVIIntent> IntentReceiver<I>.send(intent: I)
inline fun <I : MVIIntent> IntentReceiver<I>.send(vararg intents: I)

Alias for IntentReceiver.intent for multiple intents