CompositionLocal

data class CompositionLocal<T>(val type: KClass<*>, val defaultValue: () -> T)

A build-time equivalent of Compose's CompositionLocal: a typed slot that DSL code can read (current) without it being threaded explicitly through every builder call, and that a scope of the tree can override for its descendants via CompositionLocalProvider. Used internally by builders that need ambient state (e.g. the current lazy-item/row/column scope) during tile composition.

Parameters

type

Runtime type of the held value, used to key it in BuildContext.

defaultValue

Value returned by current when nothing has provided an override.

Constructors

Link copied to clipboard
constructor(type: KClass<*>, defaultValue: () -> T)

Properties

Link copied to clipboard
val defaultValue: () -> T
Link copied to clipboard
val type: KClass<*>

Functions

Link copied to clipboard

Reads the value currently provided for this CompositionLocal, or its CompositionLocal.defaultValue if none was provided.

Link copied to clipboard

Pairs this local with value, ready to be passed to CompositionLocalProvider.