This file contains hidden or 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
| abstract class MVIViewModel<State, Event>( | |
| protected val savedStateHandle: SavedStateHandle? = null, | |
| ) : ViewModel() { | |
| private val _uiState by lazy { MutableStateFlow(initialState()) } | |
| val uiState get() = _uiState.asStateFlow() | |
| fun update(block: State.() -> State) { | |
| _uiState.update(block) | |
| } |