Created
October 25, 2022 20:13
-
-
Save mcatta/c6ecd09b92dc5bd6413867b4c913e785 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@OptIn(FlowPreview::class, ExperimentalCoroutinesApi::class) | |
abstract class AbsStateViewModel<State: Any, Action: Any>( | |
private val stateMachine: FlowReduxStateMachine<State, Action> | |
): BaseViewModel() { | |
@Composable | |
fun rememberState() = stateMachine.rememberState() | |
fun dispatch(action: Action) = viewModelScope.launch { | |
stateMachine.dispatch(action = action) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment