composition For
fun compositionFor(key: Any, applier: Applier<*>, parent: CompositionReference, onCreated: () -> Unit = {}): Composition
Content copied to clipboard
This method is the way to initiate a composition. Optionally, a parent can be provided to make the composition behave as a sub-composition of the parent.
It is important to call Composition.dispose whenever this key is no longer needed in order to release resources.
Samples
androidx.compose.runtime.samples.CustomTreeComposition
See also
Parameters
applier
The Applier instance to be used in the composition.
key
The object this composition will be tied to. Only one Composition will be created for a given key. If the same key is passed in subsequent calls, the same Composition instance will be returned.
onCreated
A function which will be executed only when the Composition is created.
parent
The parent composition reference, if applicable. Default is null.