HostDefaultProvider


An interface that allows the hosting environment (the platform embedding the Compose content) to provide default values for CompositionLocals based on a key.

This acts as a bridge or service locator, allowing platform-agnostic libraries to retrieve platform-specific components (like LifecycleOwner or ViewModelStoreOwner) without depending directly on platform artifacts (e.g., android.view.View).

Summary

Public functions

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

Retrieves a default value identified by key from the host environment.

Cmn

Public functions

getHostDefault

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

Retrieves a default value identified by key from the host environment.

Parameters
key: HostDefaultKey<T>

The identifier for the value to retrieve. The type and meaning of the key are defined by the host implementation (e.g., an Android resource ID).

Returns
T

The requested value, or null if not found.