Skip to content

//reactivestate/com.ensody.reactivestate.android/stateFlowViewModel

stateFlowViewModel

[android]\ inline fun <T : ViewModel> ComponentActivity.stateFlowViewModel(crossinline provider: (handle: SavedStateHandleStore) -> T): Lazy<T>

inline fun <T : ViewModel> Fragment.stateFlowViewModel(crossinline provider: (store: SavedStateHandleStore) -> T): Lazy<T>

Creates a ViewModel with a SavedStateHandleStore.

The provider should instantiate the ViewModel directly.

See also

reactiveState if you want to create multiplatform ReactiveState ViewModels.