# HostDefaultProvider

Artifact: [androidx.compose.runtime:runtime](https://developer.android.com/jetpack/androidx/releases/compose-runtime) [View Source](https://cs.android.com/search?q=file:androidx/compose/runtime/HostDefaultProvider.kt+class:androidx.compose.runtime.HostDefaultProvider) Added in [1.11.0](https://developer.android.com/jetpack/androidx/releases/compose-runtime#1.11.0) Common/AllAndroid/JVMNative/C/iOSJavaScript
- Cmn

  ```
  interface HostDefaultProvider
  ```

*** ** * ** ***

An interface that allows the hosting environment (e.g., Android, Desktop, or iOS) to provide default values for `https://developer.android.com/reference/kotlin/androidx/compose/runtime/CompositionLocal` using `https://developer.android.com/reference/kotlin/androidx/compose/runtime/package-summary#compositionLocalWithHostDefaultOf(androidx.compose.runtime.HostDefaultKey)`.

This acts as a decoupling layer, allowing platform-agnostic libraries to request platform-specific components ((like `LifecycleOwner` or `ViewModelStoreOwner`) without depending on platform-specific APIs or artifacts.

## Summary

| ### Public functions |
|---|---|---|
| `T` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/compose/runtime/HostDefaultProvider#getHostDefault(androidx.compose.runtime.HostDefaultKey)(key: https://developer.android.com/reference/kotlin/androidx/compose/runtime/HostDefaultKey<T>)` Retrieves a value associated with `https://developer.android.com/reference/kotlin/androidx/compose/runtime/HostDefaultProvider#getHostDefault(androidx.compose.runtime.HostDefaultKey)` from the host environment. | Cmn |

## Public functions

### getHostDefault

Cmn Added in [1.11.0](https://developer.android.com/jetpack/androidx/releases/compose-runtime#1.11.0)

```
fun <T : Any?> getHostDefault(key: HostDefaultKey<T>): T
```

Retrieves a value associated with `https://developer.android.com/reference/kotlin/androidx/compose/runtime/HostDefaultProvider#getHostDefault(androidx.compose.runtime.HostDefaultKey)` from the host environment.