{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

CompositionContext

public abstract class CompositionContext

Known direct subclasses
Recomposer

The scheduler for performing recomposition and applying updates to one or more Compositions.


A CompositionContext is an opaque type that is used to logically "link" two compositions together. The CompositionContext instance represents a reference to the "parent" composition in a specific position of that composition's tree, and the instance can then be given to a new "child" composition. This reference ensures that invalidations and CompositionLocals flow logically through the two compositions as if they were not separate.

The "parent" of a root composition is a Recomposer.

See also
rememberCompositionContext

Summary

Public methods

abstract @NonNull CoroutineContext

The CoroutineContext with which effects for the composition will be executed in.

Public methods

getEffectCoroutineContext

public abstract @NonNull CoroutineContext getEffectCoroutineContext()

The CoroutineContext with which effects for the composition will be executed in.