<div class='sourceset sourceset-common'>Common</div>

```kotlin
sealed interface PausedPrecomposition
```

A [PausedPrecomposition](/jetpack-compose/androidx.compose.ui/ui/interfaces/SubcomposeLayoutState.PausedPrecomposition) is a subcomposition that can be composed incrementally as it
supports being paused and resumed.

Pausable subcomposition can be used between frames to prepare a subcomposition before it is
required by the main composition. For example, this is used in lazy lists to prepare list
items in between frames to that are likely to be scrolled in. The composition is paused when
the start of the next frame is near, allowing composition to be spread across multiple frames
without delaying the production of the next frame.

## Properties

<div class='sourceset sourceset-common'>Common</div>

```kotlin
val isComplete: Boolean
```

Returns `true` when the [PausedPrecomposition](/jetpack-compose/androidx.compose.ui/ui/interfaces/SubcomposeLayoutState.PausedPrecomposition) is complete. [isComplete](#iscomplete) matches the last
value returned from [resume](#resume). Once a [PausedPrecomposition](/jetpack-compose/androidx.compose.ui/ui/interfaces/SubcomposeLayoutState.PausedPrecomposition) is [isComplete](#iscomplete) the [apply](/jetpack-compose/androidx.compose.foundation/foundation/functions/apply)
method should be called. If the [apply](/jetpack-compose/androidx.compose.foundation/foundation/functions/apply) method is not called synchronously and
immediately after [resume](#resume) returns `true` then this [isComplete](#iscomplete) can return `false` as
any state changes read by the paused composition while it is paused will cause the
composition to require the paused composition to need to be resumed before it is used.

## Functions

<h2 id="resume-shouldpause">resume</h2>

```kotlin
fun resume(shouldPause: ShouldPauseCallback): Boolean
```

Resume the composition that has been paused. This method should be called until [resume](#resume)
returns `true` or [isComplete](#iscomplete) is `true` which has the same result as the last result of
calling [resume](#resume). The `shouldPause` parameter is a lambda that returns whether the
composition should be paused. For example, in lazy lists this returns `false` until just
prior to the next frame starting in which it returns `true`

Calling [resume](#resume) after it returns `true` or when `isComplete` is true will throw an
exception.

#### Parameters

| | |
| --- | --- |
| shouldPause | A lambda that is used to determine if the composition should be paused. This lambda is called often so should be a very simple calculation. Returning `true` does not guarantee the composition will pause, it should only be considered a request to pause the composition. Not all composable functions are pausable and only pausable composition functions will pause. |

#### Returns

| | |
| --- | --- |
|  | `true` if the composition is complete and `false` if one or more calls to `resume` are required to complete composition. |

<hr class="docs-overload-divider">

<h2 id="apply">apply</h2>

```kotlin
fun apply(): PrecomposedSlotHandle
```

Apply the composition. This is the last step of a paused composition and is required to
be called prior to the composition is usable.

Calling [apply](/jetpack-compose/androidx.compose.foundation/foundation/functions/apply) should always be proceeded with a check of [isComplete](#iscomplete) before it is
called and potentially calling [resume](#resume) in a loop until [isComplete](#iscomplete) returns `true`. This
can happen if [resume](#resume) returned `true` but [apply](/jetpack-compose/androidx.compose.foundation/foundation/functions/apply) was not synchronously called
immediately afterwords. Any state that was read that changed between when [resume](#resume) being
called and [apply](/jetpack-compose/androidx.compose.foundation/foundation/functions/apply) being called may require the paused composition to be resumed before
applied.

#### Returns

| | |
| --- | --- |
|  | [PrecomposedSlotHandle](/jetpack-compose/androidx.compose.ui/ui/interfaces/SubcomposeLayoutState.PrecomposedSlotHandle) you can use to premeasure the slot as well, or to dispose the composed content. |

<hr class="docs-overload-divider">

<h2 id="cancel">cancel</h2>

```kotlin
fun cancel()
```

Cancels the paused composition. This should only be used if the composition is going to
be disposed and the entire composition is not going to be used.