Mavericks View Model
All Mavericks ViewModels must extend this class. In Mavericks, ViewModels are generic on a single state class. The ViewModel owns all state modifications via setState and other classes may observe the state.
From a MavericksView/Fragment, using the view model provider delegates will automatically subscribe to state updates in a lifecycle-aware way and call MavericksView.invalidate whenever it changes.
Other classes can observe the state via stateFlow.
Constructors
MavericksViewModel
Link copied to clipboard
Functions
await State
Link copied to clipboard
Calling this function suspends until all pending setState reducers are run and then returns the latest state. As a result, it is safe to call setState { } and assume that the result from a subsequent awaitState() call will have that state.
Properties
config
Link copied to clipboard
stateFlow
Link copied to clipboard
viewModelScope
Link copied to clipboard