ComposableOpenTarget
@Target(
AnnotationTarget.FUNCTION,
AnnotationTarget.PROPERTY_GETTER,
AnnotationTarget.TYPE,
AnnotationTarget.TYPE_PARAMETER,
)
public annotation class ComposableOpenTarget(val index: Int)
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.
Parameters
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. |