The Developer Preview for Android 11 is now available; test it out and share your feedback.


interface ValueHolder<T : Any>

A value holder that is responsible for containing one value if type T.

This interface is particularly useful to implement in @Model classes, to provide for users of this class a choice to consume value (therefore being recomposed every time value changes) or consume ValueHolder and decide themselves when to read this value.

On of the examples might be when you want to reflect some animation / dragging changes in ui but you don't want to be recomposed every time, but only relayout. To achieve this, might require ValueHolder to be passed to you and read it during layout stage, avoiding recomposition.


Inherited extension functions

From androidx.compose
operator T

IMPORTANT: This global operator is TEMPORARY, and should be removed whenever an answer for contextual composers is reached.


abstract T

variable value that this holder holds



abstract val value: T

variable value that this holder holds