StoreBuilder

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.

Parameters

initial

initial state the store will have.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val initial: S
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var name: String?
Link copied to clipboard
var onOverflow: BufferOverflow
Link copied to clipboard

Functions

Link copied to clipboard
fun <S : MVIState, I : MVIIntent, A : MVIAction> StoreBuilder<S, I, A>.androidLoggingPlugin(name: String? = null, level: Int? = null)

Create a new loggingPlugin that prints using android's Log.

Link copied to clipboard
fun <S : MVIState, I : MVIIntent, A : MVIAction> StoreBuilder<S, I, A>.awaitSubscribers(manager: SubscriberManager = SubscriberManager(), minSubs: Int = 1, suspendStore: Boolean = true, timeout: Duration = Duration.INFINITE, name: String = SubscriberManager.Name): SubscriberManager

Installs a new awaitSubscribersPlugin

Link copied to clipboard
fun <T, S : MVIState, I : MVIIntent, A : MVIAction> StoreBuilder<S, I, A>.cache(name: String? = null, init: suspend PipelineContext<S, I, A>.() -> T): CachedValue<T, S, I, A>

Creates and installs a new CachedValue, returning a delegate that can be used to get access to the property that was cached. Please consult the documentation of the parent class to understand how to use this plugin.

Link copied to clipboard
inline fun configure(block: StoreConfigurationBuilder.() -> Unit)

Adjust the current StoreConfiguration of this Store.

Link copied to clipboard
fun <S : MVIState, I : MVIIntent, A : MVIAction> StoreBuilder<S, I, A>.consumeIntents(name: String = ConsumeIntentsPluginName)

Create and install a plugin that consumes intents and does nothing with them.

Link copied to clipboard

Installs a new disallowRestartPlugin. Please consult the docs of the parent function to learn more. This plugin can only be installed only once.

Link copied to clipboard
fun <S : MVIState, I : MVIIntent, A : MVIAction> StoreBuilder<S, I, A>.enableLogging(tag: String? = null, level: StoreLogLevel? = null, name: String? = null, logger: StoreLogger? = null)

Install a new loggingPlugin.

Link copied to clipboard
fun <S : MVIState, I : MVIIntent, A : MVIAction> StoreBuilder<S, I, A>.init(block: suspend PipelineContext<S, I, A>.() -> Unit)

Installs a plugin that invokes block when pro.respawn.flowmvi.api.Store.start is called.

Link copied to clipboard

Alias for install

inline fun install(crossinline block: LazyPluginBuilder<S, I, A>.() -> Unit)

Create and install a new StorePlugin. Please see documentation for the other overload for more details.

fun install(plugins: Iterable<LazyPlugin<S, I, A>>)
fun install(plugin: LazyPlugin<S, I, A>, vararg other: LazyPlugin<S, I, A>)

Install StorePlugins. See the other overload to build the plugin on the fly. This installs prebuilt plugins.

Link copied to clipboard
fun <K : Any, A : MVIAction, I : MVIIntent, S : MVIState> StoreBuilder<S, I, A>.manageJobs(jobs: JobManager<K> = JobManager(), name: String = JobManager.Name): JobManager<K>

Create and install a new plugin that uses JobManager to manage running jobs. The plugin will cancel all running jobs if the store is closed.

Link copied to clipboard
inline fun <S : MVIState, I : MVIIntent, A : MVIAction, S2 : MVIState, I2 : MVIIntent> StoreBuilder<S, I, A>.parentStore(parent: Store<S2, I2, *>, name: String? = parent.name?.let { "ParentStorePlugin\$$it" }, minExternalSubscriptions: Int = 1, crossinline render: suspend PipelineContext<S, I, A>.(state: S2) -> Unit)

Install a new parentStorePlugin. This overload does not collect the parent store's actions.

inline fun <S : MVIState, I : MVIIntent, A : MVIAction, S2 : MVIState, I2 : MVIIntent, A2 : MVIAction> StoreBuilder<S, I, A>.parentStore(parent: Store<S2, I2, A2>, name: String? = parent.name?.let { "ParentStorePlugin\$$it" }, minExternalSubscriptions: Int = 1, crossinline consume: suspend PipelineContext<S, I, A>.(action: A2) -> Unit, crossinline render: suspend PipelineContext<S, I, A>.(state: S2) -> Unit)

Install a new parentStorePlugin.

Link copied to clipboard
fun <S : MVIState, I : MVIIntent, A : MVIAction> StoreBuilder<S, I, A>.recover(name: String? = null, recover: Recover<S, I, A>)

Create and install a recoverPlugin.

Link copied to clipboard
inline fun <S : MVIState, I : MVIIntent, A : MVIAction> StoreBuilder<S, I, A>.reduce(consume: Boolean = true, name: String = ReducePluginName, crossinline reduce: Reduce<S, I, A>)

Create and install a reducePlugin.

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
inline fun <S : MVIState, I : MVIIntent, A : MVIAction> StoreBuilder<S, I, A>.saveState(name: String = DefaultSavedStatePluginName, context: CoroutineContext = EmptyCoroutineContext, crossinline get: suspend S.() -> S?, crossinline set: suspend S.() -> Unit)

Creates and installs a new savedStatePlugin.

Link copied to clipboard
fun <S : MVIState, I : MVIIntent, A : MVIAction> StoreBuilder<S, I, A>.timeTravel(historySize: Int = TimeTravel.DefaultHistorySize, name: String = TimeTravel.Name): TimeTravel<S, I, A>

Create a new TimeTravel and installs it. Keep a reference to the returning value to use its properties.

fun <S : MVIState, I : MVIIntent, A : MVIAction> StoreBuilder<S, I, A>.timeTravel(timeTravel: TimeTravel<S, I, A>, name: String = TimeTravel.Name)

Create a new TimeTravel and installs it. Keep a reference to the object to use its properties.

Link copied to clipboard
fun <S : MVIState, I : MVIIntent, A : MVIAction> StoreBuilder<S, I, A>.undoRedo(maxQueueSize: Int, name: String? = null, resetOnException: Boolean = true): UndoRedo

Creates, installs and returns a new UndoRedo instance

Link copied to clipboard
inline fun <S : MVIState, I : MVIIntent, A : MVIAction> StoreBuilder<S, I, A>.whileSubscribed(name: String? = null, minSubscriptions: Int = 1, crossinline block: suspend PipelineContext<S, I, A>.() -> Unit)

Create and install a new whileSubscribed plugin. See the parent's function docs for more info.