-
public final class ViewModelStoreOwnerExtKt
-
-
Method Summary
Modifier and Type Method Description final static <T extends Store<?, ?, ?>> ReadOnlyProperty<ViewModelStoreOwner, T>storeViaViewModel(CoroutineContext coroutineContext, String sharedViewModelKey, Function0<T> factory)Lazily gets kotea Store from the ViewModelStore. final static <T extends Store<?, ?, ?>> ReadOnlyProperty<ViewModelStoreOwner, T>storeViaViewModel(CoroutineContext coroutineContext, String sharedViewModelKey, Function0<ViewModelStoreOwner> sharedViewModelStoreOwner, Function0<T> factory)Lazily gets kotea Store from the ViewModelStore. final static <T extends Store<?, ?, ?>> ReadOnlyProperty<ViewModelStoreOwner, T>storeViaViewModel(CoroutineDispatcher dispatcher, String sharedViewModelKey, Function0<T> factory)final static <T extends Store<?, ?, ?>> ReadOnlyProperty<ViewModelStoreOwner, T>getStore(String sharedViewModelKey, Function0<ViewModelStoreOwner> viewModelStoreOwnerProvider)Try to get Kotea Store from the provided ViewModelStoreOwner. final static <T extends Store<?, ?, ?>> ReadOnlyProperty<ViewModelStoreOwner, T>getStoreOrNull(String sharedViewModelKey, Function0<ViewModelStoreOwner> viewModelStoreOwnerProvider)Try to get Kotea Store from the provided ViewModelStoreOwner. -
-
Method Detail
-
storeViaViewModel
final static <T extends Store<?, ?, ?>> ReadOnlyProperty<ViewModelStoreOwner, T> storeViaViewModel(CoroutineContext coroutineContext, String sharedViewModelKey, Function0<T> factory)
Lazily gets kotea Store from the ViewModelStore. Launches it in the ViewModel.viewModelScope with the specified CoroutineContext on first access.
By default uses a containing class and property names as a ViewModel key, but you can share Store across a screens by specifying the sharedViewModelKey.
- Parameters:
coroutineContext- CoroutineContext to launch Store in.sharedViewModelKey- key to share Store across a screens.factory- factory to create Store
-
storeViaViewModel
final static <T extends Store<?, ?, ?>> ReadOnlyProperty<ViewModelStoreOwner, T> storeViaViewModel(CoroutineContext coroutineContext, String sharedViewModelKey, Function0<ViewModelStoreOwner> sharedViewModelStoreOwner, Function0<T> factory)
Lazily gets kotea Store from the ViewModelStore. Launches it in the ViewModel.viewModelScope with the specified CoroutineContext on first access.
By default uses a containing class and property names as a ViewModel key, but you can share Store across a screens by specifying the sharedViewModelKey.
- Parameters:
coroutineContext- CoroutineContext to launch Store in.sharedViewModelKey- key to share Store across a screens.sharedViewModelStoreOwner- that Store will associate with.factory- factory to create Store
-
storeViaViewModel
@Deprecated(message = Use storeViewViewModel function with coroutine context param, level = DeprecationLevel.HIDDEN) final static <T extends Store<?, ?, ?>> ReadOnlyProperty<ViewModelStoreOwner, T> storeViaViewModel(CoroutineDispatcher dispatcher, String sharedViewModelKey, Function0<T> factory)
-
getStore
@ExperimentalKoteaApi() final static <T extends Store<?, ?, ?>> ReadOnlyProperty<ViewModelStoreOwner, T> getStore(String sharedViewModelKey, Function0<ViewModelStoreOwner> viewModelStoreOwnerProvider)
Try to get Kotea Store from the provided ViewModelStoreOwner. If it does not exist, @throws RuntimeException.
- Parameters:
sharedViewModelKey- key to share Store across a screens.viewModelStoreOwnerProvider- that Store will associate with.
-
getStoreOrNull
@ExperimentalKoteaApi() final static <T extends Store<?, ?, ?>> ReadOnlyProperty<ViewModelStoreOwner, T> getStoreOrNull(String sharedViewModelKey, Function0<ViewModelStoreOwner> viewModelStoreOwnerProvider)
Try to get Kotea Store from the provided ViewModelStoreOwner.
- Parameters:
sharedViewModelKey- key to share Store across a screens.viewModelStoreOwnerProvider- that Store will associate with.
-
-
-
-