//reactivestate-compose/com.ensody.reactivestate.compose
Package-level declarations¶
Types¶
Name | Summary |
---|---|
WrapperViewModel | [compose] class WrapperViewModel<T>(provider: (CoroutineScope) -> T) : ViewModel A wrapper ViewModel used to hold an arbitrary value. |
Functions¶
Name | Summary |
---|---|
afterUpdate | [common] @Composable fun <T> MutableState<T>.afterUpdate(setter: MutableState<T>.(T) -> Unit): MutableState<T> Returns a new MutableState that calls setter after doing the actual value update. |
beforeUpdate | [common] @Composable fun <T> MutableState<T>.beforeUpdate(setter: MutableState<T>.(T) -> Unit): MutableState<T> Returns a new MutableState that calls setter before doing the actual value update. |
collectAsMutableState | [common] @Composable fun <T> MutableStateFlow<T>.collectAsMutableState(context: CoroutineContext = EmptyCoroutineContext): MutableState<T> Converts this MutableStateFlow to a MutableState. |
onViewModel | [compose] @ExperimentalReactiveStateApi @Composable 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. |
reactiveState | [compose] @ExperimentalReactiveStateApi @Composable inline fun <E : ErrorEvents, VM : ReactiveState<E>> E.reactiveState(key: String? = null, crossinline observeLoadingEffect: @Composable(viewModel: VM) -> Unit, crossinline provider: ReactiveStateContext.() -> VM): VM Creates a multiplatform ReactiveState ViewModel and observes its ReactiveState.eventNotifier. |
reactiveViewModel | [compose] @ExperimentalReactiveStateApi @Composable inline fun <VM : ReactiveViewModel> ErrorEvents.reactiveViewModel(key: String? = null, crossinline observeLoadingEffect: @Composable(viewModel: VM) -> Unit, crossinline provider: ReactiveViewModelContext.() -> VM): VM Creates a multiplatform ReactiveState ViewModel and observes its ReactiveState.eventNotifier. |
toMutable | [common] @Composable 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. |
withSetter | [common] @Composable fun <T> MutableState<T>.withSetter(setter: MutableState<T>.(T) -> Unit): MutableState<T> Returns a new MutableState that calls setter instead of doing the actual value update. |