loadingStateOf
Runs block and wraps its outcome as LoadingState.Loaded or LoadingState.Failed (classified through LoadingError.from). Coroutine cancellation is rethrown, never reported as a failure.
updateState { copy(items = LoadingState.Loading) }
val items = loadingStateOf { repository.fetchItems() }
updateState { copy(items = items) }Content copied to clipboard