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

ComposableOpenTarget

@Retention(value = AnnotationRetention.BINARY)
@Target(allowedTargets = [AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.TYPE, AnnotationTarget.TYPE_PARAMETER])
public annotation ComposableOpenTarget


The Composable declares that it doesn't expect a particular applier. See ComposableTarget for more details on what appliers a Composable function expects.

In a Composable function, all the open composable appliers with the same applier index must have the same name.. CompositionLocalProvider, for example, can use ComposableOpenTarget to declare that its content parameter must have the same applier as it receives, since it calls the content parameter directly, but it could be any applier. ComposableOpenTarget, in this way, works like an open type parameter for the type of applier used by the implied composer parameter.

Th ComposableOpenTarget is unlikely to be required explicitly as it is inferred automatically by the Compose compiler plugin. See ComposableTarget for more details on how attributes are inferred.

Summary

Public constructors

Public methods

final int

The index of the open applier parameter.

Public constructors

ComposableOpenTarget

public ComposableOpenTarget(int index)
Parameters
int index

The index of the open applier parameter. All open appliers with the same non-negative index in the same declaration must have the same name. All negative indexes are considered anonymous and can match any applier. If the index is only used once in a declaration it can also match any applier but it is recommended to use a negative index instead or just leave the annotation off as a missing annotation is equivalent to an anonymous applier.

Public methods

getIndex

public final int getIndex()

The index of the open applier parameter. All open appliers with the same non-negative index in the same declaration must have the same name. All negative indexes are considered anonymous and can match any applier. If the index is only used once in a declaration it can also match any applier but it is recommended to use a negative index instead or just leave the annotation off as a missing annotation is equivalent to an anonymous applier.