Package-level declarations

Types

Link copied to clipboard
data class StateAndDispatch<S : Any, A : Any>(val state: State<S?>, val dispatchAction: (A) -> Unit)

This class is the return type of FlowReduxStateMachine.stateAndDispatch(). It is mainly meant to be used with Kotlin's deconstructions feature as follows:

Functions

Link copied to clipboard
@ExperimentalCoroutinesApi
@Composable
fun <S : Any, A : Any> FlowReduxStateMachine<S, A>.rememberState(): State<S?>

Get a Compose State object from a FlowReduxStateMachine.

Link copied to clipboard
@ExperimentalCoroutinesApi
@Composable
fun <S : Any, A : Any> FlowReduxStateMachine<S, A>.rememberStateAndDispatch(): StateAndDispatch<S, A>

Convenient way to get a Compose State to get state update of a FlowReduxStateMachine and a function of type (Action) -> Unit to dispatch Actions to a FlowReduxStateMachine. Under the hood State will be updated only as long as the surrounding Composable is in use. The dispatch function (Action) -> Unit is tight to the same Composable component and launches a coroutine to dispatch actions async. to the FlowReduxStateMachine.