# SubcomposeLayoutState.PrecomposedSlotHandle

Artifact: [androidx.compose.ui:ui](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/layout/SubcomposeLayout.kt+class:androidx.compose.ui.layout.SubcomposeLayoutState.PrecomposedSlotHandle) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0) Common/AllAndroid/JVM
- Cmn

  ```
  interface SubcomposeLayoutState.PrecomposedSlotHandle
  ```

*** ** * ** ***

Instance of this interface is returned by `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/SubcomposeLayoutState#precompose(kotlin.Any,kotlin.Function0)` function.

## Summary

| ### Public functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/SubcomposeLayoutState.PrecomposedSlotHandle#dispose()()` This function allows to dispose the content for the slot which was precomposed previously via `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/SubcomposeLayoutState#precompose(kotlin.Any,kotlin.Function0)`. | Cmn |
| `open https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntSize` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/SubcomposeLayoutState.PrecomposedSlotHandle#getSize(kotlin.Int)(index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Retrieves the latest measured size for a given placeable `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/SubcomposeLayoutState.PrecomposedSlotHandle#getSize(kotlin.Int)`. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/SubcomposeLayoutState.PrecomposedSlotHandle#premeasure(kotlin.Int,androidx.compose.ui.unit.Constraints)(index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, constraints: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints)` Performs synchronous measure of the placeable at the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/SubcomposeLayoutState.PrecomposedSlotHandle#premeasure(kotlin.Int,androidx.compose.ui.unit.Constraints)`. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/SubcomposeLayoutState.PrecomposedSlotHandle#traverseDescendants(kotlin.Any,kotlin.Function1)( key: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?, block: (https://developer.android.com/reference/kotlin/androidx/compose/ui/node/TraversableNode) -> https://developer.android.com/reference/kotlin/androidx/compose/ui/node/TraversableNode.Companion.TraverseDescendantsAction )` Conditionally executes `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/SubcomposeLayoutState.PrecomposedSlotHandle#traverseDescendants(kotlin.Any,kotlin.Function1)` for each `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier.Node` of this Composition that is a `https://developer.android.com/reference/kotlin/androidx/compose/ui/node/TraversableNode` with a matching `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/SubcomposeLayoutState.PrecomposedSlotHandle#traverseDescendants(kotlin.Any,kotlin.Function1)`. | Cmn |

| ### Public properties |
|---|---|---|
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/SubcomposeLayoutState.PrecomposedSlotHandle#placeablesCount()` The amount of placeables composed into this slot. | Cmn |

## Public functions

### dispose

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

```
fun dispose(): Unit
```

This function allows to dispose the content for the slot which was precomposed previously via `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/SubcomposeLayoutState#precompose(kotlin.Any,kotlin.Function0)`.

If this slot was already used during the regular measure pass via `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/SubcomposeMeasureScope#subcompose(kotlin.Any,kotlin.Function0)` this function will do nothing.

This could be useful if after the future calculations this item is not anymore expected to be used during the measure pass anytime soon.

### getSize

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

```
open fun getSize(index: Int): IntSize
```

Retrieves the latest measured size for a given placeable `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/SubcomposeLayoutState.PrecomposedSlotHandle#getSize(kotlin.Int)`. This will return `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntSize#Zero()` if this is called before `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/SubcomposeLayoutState.PrecomposedSlotHandle#premeasure(kotlin.Int,androidx.compose.ui.unit.Constraints)`.

### premeasure

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

```
open fun premeasure(index: Int, constraints: Constraints): Unit
```

Performs synchronous measure of the placeable at the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/SubcomposeLayoutState.PrecomposedSlotHandle#premeasure(kotlin.Int,androidx.compose.ui.unit.Constraints)`.

| Parameters |
|---|---|
| `index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the placeable index. Should be smaller than `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/SubcomposeLayoutState.PrecomposedSlotHandle#placeablesCount()`. |
| `constraints: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints` | Constraints to measure this placeable with. |

### traverseDescendants

Cmn

```
open fun traverseDescendants(
    key: Any?,
    block: (TraversableNode) -> TraversableNode.Companion.TraverseDescendantsAction
): Unit
```

Conditionally executes `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/SubcomposeLayoutState.PrecomposedSlotHandle#traverseDescendants(kotlin.Any,kotlin.Function1)` for each `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier.Node` of this Composition that is a `https://developer.android.com/reference/kotlin/androidx/compose/ui/node/TraversableNode` with a matching `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/SubcomposeLayoutState.PrecomposedSlotHandle#traverseDescendants(kotlin.Any,kotlin.Function1)`.

See `https://developer.android.com/reference/kotlin/androidx/compose/ui/node/package-summary#(androidx.compose.ui.node.DelegatableNode).traverseDescendants(kotlin.Any,kotlin.Function1)` for the complete semantics of this function.

## Public properties

### placeablesCount

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

```
open val placeablesCount: Int
```

The amount of placeables composed into this slot.