Google is committed to advancing racial equity for Black communities. See how.

SubcomposeMeasureScope

interface SubcomposeMeasureScope : MeasureScope
androidx.compose.ui.layout.SubcomposeMeasureScope

The receiver scope of a SubcomposeLayout's measure lambda which adds ability to dynamically subcompose a content during the measuring on top of the features provided by MeasureScope.

Summary

Public methods
abstract List<Measurable>
subcompose(slotId: Any?, content: () -> Unit)

Performs subcomposition of the provided content with given slotId.

Inherited functions
Inherited properties

Public methods

subcompose

abstract fun subcompose(
    slotId: Any?,
    content: () -> Unit
): List<Measurable>

Performs subcomposition of the provided content with given slotId.

Parameters
slotId: Any? unique id which represents the slot we are composing into. If you have fixed amount or slots you can use enums as slot ids, or if you have a list of items maybe an index in the list or some other unique key can work. To be able to correctly match the content between remeasures you should provide the object which is equals to the one you used during the previous measuring.
content: () -> Unit the composable content which defines the slot. It could emit multiple layouts, in this case the returned list of Measurables will have multiple elements.