Package-level declarations

Types

Link copied to clipboard
class WrapperViewModel<T>(provider: (CoroutineScope) -> T) : ViewModel

A wrapper ViewModel used to hold an arbitrary value.

Functions

Link copied to clipboard

Returns a new MutableState that calls setter after doing the actual value update.

Link copied to clipboard

Returns a new MutableState that calls setter before doing the actual value update.

Link copied to clipboard
fun <T> MutableStateFlow<T>.collectAsMutableState(context: CoroutineContext = EmptyCoroutineContext): MutableState<T>

Converts this MutableStateFlow to a MutableState.

Link copied to clipboard
inline fun <T> onViewModel(viewModelStoreOwner: ViewModelStoreOwner = checkNotNull(LocalViewModelStoreOwner.current) { "No ViewModelStoreOwner was provided via LocalViewModelStoreOwner" }, key: String? = null, crossinline provider: ReactiveStateContext.() -> T): T

Creates an object living on a wrapper ViewModel. This allows for building more flexible (e.g. nestable) ViewModels.

Link copied to clipboard
inline fun <VM : CoroutineLauncher> reactiveViewModel(key: String? = null, crossinline onError: (Throwable) -> Unit, crossinline provider: ReactiveStateContext.() -> VM): VM

Creates a multiplatform ViewModel. The provider should instantiate the object directly.

Link copied to clipboard
fun <T> State<T>.toMutable(setter: State<T>.(T) -> Unit): MutableState<T>

Converts this State to a MutableState that calls setter for doing the actual value update.

Link copied to clipboard

Returns a new MutableState that calls setter instead of doing the actual value update.