ValueHolder

interface ValueHolder<T : Any>
androidx.ui.foundation.ValueHolder

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.

Summary

Properties

abstract T

variable value that this holder holds

Properties

value

abstract val value: T

variable value that this holder holds