Package-level declarations

Types

Link copied to clipboard
typealias BuildStore<S, I, A> = StoreBuilder<S, I, A>.() -> Unit
Link copied to clipboard
value class LambdaIntent<S : MVIState, A : MVIAction>(block: suspend PipelineContext<S, LambdaIntent<S, A>, A>.() -> Unit) : MVIIntent

An intent that is a holder for a block that acts as this intent's logic. LambdaIntents enable MVVM+ -style declaration of your pro.respawn.flowmvi.api.Store.

Link copied to clipboard

A class that creates a LazyPlugin.

Link copied to clipboard

A builder DSL for creating a Store. Cannot be instantiated outside of store functions. After building, the StoreConfiguration is created and used in the Store. This configuration must not be changed in any way after the store is created through circumvention measures.

Link copied to clipboard

A builder class for creating StoreConfigurations.

Link copied to clipboard

A class that builds a new StorePlugin For more documentation, see StorePlugin

Properties

Link copied to clipboard

A no-op SubscriberLifecycle implementation that does not follow the system lifecycle in any way and ignores SubscriptionMode

Functions

Link copied to clipboard
inline suspend fun <A : MVIAction> ActionReceiver<A>.action(vararg actions: A)

Alias for ActionReceiver.action for multiple actions

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
inline fun <S : MVIState> configuration(initial: S, block: StoreConfigurationBuilder.() -> Unit): StoreConfiguration<S>

Create a new StoreConfiguration

Link copied to clipboard
suspend fun <A : MVIAction> A.emit()
suspend fun <I : MVIIntent> I.emit()

An alias for IntentReceiver.emit

inline suspend fun <A : MVIAction> ActionReceiver<A>.emit(action: A)
inline suspend fun <A : MVIAction> ActionReceiver<A>.emit(vararg actions: A)

Alias for ActionReceiver.action for multiple actions

inline suspend fun <I : MVIIntent> IntentReceiver<I>.emit(vararg intents: I)

Alias for IntentReceiver.emit for multiple intents

suspend fun <A : MVIAction> A.emit()
suspend fun <I : MVIIntent> I.emit()

An alias for IntentReceiver.emit

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
inline fun <S : MVIState, I : MVIIntent, A : MVIAction> lazyPlugin(crossinline builder: LazyPluginBuilder<S, I, A>.() -> Unit): LazyPlugin<S, I, A>

Build a new StorePlugin using StorePluginBuilder lazily. Plugin will be created upon first usage (i.e. installation).

Link copied to clipboard
inline fun <S : MVIState, I : MVIIntent, A : MVIAction> lazyStore(initial: S, mode: LazyThreadSafetyMode = LazyThreadSafetyMode.SYNCHRONIZED, crossinline configure: BuildStore<S, I, A>): Lazy<Store<S, I, A>>

Build a new Store using StoreBuilder. The store is created lazily, with all its plugins. The store is not launched.

inline fun <S : MVIState, I : MVIIntent, A : MVIAction> lazyStore(initial: S, scope: CoroutineScope, mode: LazyThreadSafetyMode = LazyThreadSafetyMode.SYNCHRONIZED, crossinline configure: BuildStore<S, I, A>): Lazy<Store<S, I, A>>

Build a new Store using StoreBuilder. The store is built lazily and launched on first access (i.e. immediately after creation).

Link copied to clipboard
inline fun <S : MVIState, I : MVIIntent, A : MVIAction> ImmutableContainer<S, I, A>.lazyStore(initial: S, mode: LazyThreadSafetyMode = LazyThreadSafetyMode.SYNCHRONIZED, crossinline configure: BuildStore<S, I, A>): Lazy<Store<S, I, A>>
inline fun <S : MVIState, I : MVIIntent, A : MVIAction> ImmutableContainer<S, I, A>.lazyStore(initial: S, scope: CoroutineScope, mode: LazyThreadSafetyMode = LazyThreadSafetyMode.SYNCHRONIZED, crossinline configure: BuildStore<S, I, A>): Lazy<Store<S, I, A>>

Alias for pro.respawn.flowmvi.dsl.lazyStore (with a scope)

Link copied to clipboard
inline suspend fun <S : MVIState, I : MVIIntent, A : MVIAction> pipelineContext(): PipelineContext<S, I, A>?

Obtain the pipeline context of the current coroutine, if present, and cast it to types S, I, and A

Link copied to clipboard
inline fun <S : MVIState, I : MVIIntent, A : MVIAction> plugin(builder: StorePluginBuilder<S, I, A>.() -> Unit): StorePlugin<S, I, A>

Build a new StorePlugin using StorePluginBuilder. See StoreBuilder.install to install the plugin automatically.

Link copied to clipboard
fun <S : MVIState, A : MVIAction> StoreBuilder<S, LambdaIntent<S, A>, A>.reduceLambdas(name: String = ReducePluginName, consume: Boolean = true)

Install a new pro.respawn.flowmvi.plugins.reducePlugin that is tailored for LambdaIntents.

Link copied to clipboard
suspend fun <A : MVIAction> A.send()
fun <I : MVIIntent> I.send()

An alias for IntentReceiver.send

inline fun <A : MVIAction> ActionReceiver<A>.send(vararg actions: A)

Alias for ActionReceiver.send for multiple actions

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

suspend fun <A : MVIAction> A.send()
fun <I : MVIIntent> I.send()

An alias for IntentReceiver.send

Link copied to clipboard
inline fun <S : MVIState, I : MVIIntent, A : MVIAction> store(initial: S, configure: BuildStore<S, I, A>): Store<S, I, A>

Build a new Store using StoreBuilder. The store is created eagerly, with all its plugins. However, the store is not launched upon creation until called "launch", which means, no heavy operations will be performed at creation time.

@JvmName(name = "noActionStore")
inline fun <S : MVIState, I : MVIIntent> store(initial: S, configure: BuildStore<S, I, Nothing>): Store<S, I, Nothing>

If your code doesn't compile, you are looking for another overload with three type parameters, i.e: store<_, _, _>()

inline fun <S : MVIState, I : MVIIntent, A : MVIAction> store(initial: S, scope: CoroutineScope, configure: BuildStore<S, I, A>): Store<S, I, A>

Build a new Store using StoreBuilder. The store is created eagerly and then launched in the given scope immediately.

Link copied to clipboard
inline fun <S : MVIState, I : MVIIntent, A : MVIAction> ImmutableContainer<S, I, A>.store(initial: S, crossinline configure: BuildStore<S, I, A>): Store<S, I, A>
inline fun <S : MVIState, I : MVIIntent, A : MVIAction> ImmutableContainer<S, I, A>.store(initial: S, scope: CoroutineScope, crossinline configure: BuildStore<S, I, A>): Store<S, I, A>
Link copied to clipboard
fun <S : MVIState, I : MVIIntent, A : MVIAction, T : ActionConsumer<A>, StateConsumer<S>> T.subscribe(store: ImmutableStore<S, I, A>, scope: CoroutineScope): Job

Subscribe to the store and invoke ActionConsumer.consume and StateConsumer.render in parallel in the provided scope.

@JvmName(name = "subscribeAndRender")
inline fun <S : MVIState, I : MVIIntent, A : MVIAction> CoroutineScope.subscribe(store: ImmutableStore<S, I, A>, crossinline render: suspend (state: S) -> Unit): Job

Subscribe to the store and invoke render. This does not collect store's actions.

@JvmName(name = "subscribeConsume")
inline fun <S : MVIState, I : MVIIntent, A : MVIAction> CoroutineScope.subscribe(store: ImmutableStore<S, I, A>, crossinline consume: suspend Provider<S, I, A>.() -> Unit): Job

Subscribe to the store. An overload of Store.subscribe that is applied on CoroutineScope.

fun <S : MVIState, I : MVIIntent, A : MVIAction> StateConsumer<S>.subscribe(store: ImmutableStore<S, I, A>, scope: CoroutineScope): Job

Subscribe to the store and invoke StateConsumer.render in the provided scope.

@JvmName(name = "subscribeAndRender")
inline fun <S : MVIState, I : MVIIntent, A : MVIAction> CoroutineScope.subscribe(store: ImmutableStore<S, I, A>, crossinline consume: suspend (action: A) -> Unit, crossinline render: suspend (state: S) -> Unit): Job

Subscribe to the store and invoke consume and render in parallel in the provided scope.

Link copied to clipboard
fun <T> SubscriberLifecycle(delegate: T, repeatOnLifecycle: suspend T.(mode: SubscriptionMode, block: suspend CoroutineScope.() -> Unit) -> Unit): SubscriberLifecycle

Create a SubscriberLifecycle by delegating the repeatOnLifecycle method to delegate

Link copied to clipboard
inline suspend fun <T : S, S : MVIState> StateReceiver<S>.updateState(crossinline transform: suspend T.() -> S)

A typed overload of StateReceiver.updateState.

Link copied to clipboard
inline fun <T : S, S : MVIState> StateReceiver<S>.updateStateImmediate(crossinline transform: T.() -> S)
Link copied to clipboard
inline fun <T : S, S : MVIState> StateReceiver<S>.useState(crossinline transform: T.() -> S)
Link copied to clipboard
inline suspend fun <T : S, S : MVIState> StateReceiver<S>.withState(crossinline block: suspend T.() -> Unit)

A typed overload of StateReceiver.withState.