ReusableComposition

Known direct subclasses
PausableComposition

A PausableComposition is a sub-composition that can be composed incrementally as it supports being paused and resumed.


A ReusableComposition is a Composition that can be reused for different composable content.

This interface is used by components that have to synchronize lifecycle of parent and child compositions and efficiently reuse the nodes emitted by ReusableComposeNode.

Summary

Public functions

Unit

Deactivate all observation scopes in composition and remove all remembered slots while preserving nodes in place.

Cmn
Unit

Update the composition with the content described by the content composable.

Cmn

Inherited functions

From androidx.compose.runtime.Composition
Unit

Clear the hierarchy that was created from the composition and release resources allocated for composition.

Cmn
Unit
setContent(content: @Composable () -> Unit)

Update the composition with the content described by the content composable.

Cmn

Inherited properties

From androidx.compose.runtime.Composition
Boolean

Returns true if any pending invalidations have been scheduled.

Cmn
Boolean

True if dispose has been called.

Cmn

Public functions

deactivate

fun deactivate(): Unit

Deactivate all observation scopes in composition and remove all remembered slots while preserving nodes in place. The composition can be re-activated by calling setContent with a new content.

setContentWithReuse

fun setContentWithReuse(content: @Composable () -> Unit): Unit

Update the composition with the content described by the content composable. After this has been called the changes to produce the initial composition has been calculated and applied to the composition.

This method forces this composition into "reusing" state before setting content. In reusing state, all remembered content is discarded, and nodes emitted by ReusableComposeNode are re-used for the new content. The nodes are only reused if the group structure containing the node matches new content.

Will throw an IllegalStateException if the composition has been disposed.

Parameters
content: @Composable () -> Unit

A composable function that describes the content of the composition.

Throws
kotlin.IllegalStateException

thrown in the composition has been disposed.