Updater
inline class Updater<T>
kotlin.Any | |
↳ | androidx.compose.runtime.Updater |
A helper receiver scope class used by ComposeNode to help write code to initialized and update a node.
Summary
Public constructors | |
---|---|
A helper receiver scope class used by ComposeNode to help write code to initialized and update a node. |
Public methods | |
---|---|
Unit |
Initialize emitted node. |
Unit |
Reconcile the node to the current state. |
Unit |
Set the value property of the emitted node. |
Unit |
Set the value property of the emitted node. |
Unit |
Update the value of a property of the emitted node. |
Unit |
Update the value of a property of the emitted node. |
Public constructors
<init>
Updater(composer: Composer)
A helper receiver scope class used by ComposeNode to help write code to initialized and update a node.
See Also
Public methods
init
fun init(block: T.() -> Unit): Unit
Initialize emitted node.
Schedule block to be executed after the node is created.
This is only executed once. The can be used to call a method or set a value on a node instance that is required to be set after one or more other properties have been set.
See Also
reconcile
fun reconcile(block: T.() -> Unit): Unit
Reconcile the node to the current state.
This is used when set and update are insufficient to update the state of the node based on changes passed to the function calling ComposeNode.
Schedules block to execute. As this unconditionally schedules block to executed it might be executed unnecessarily as no effort is taken to ensure it only executes when the values block captures have changed. It is highly recommended that set and update be used instead as they will only schedule their blocks to executed when the value passed to them has changed.
set
inline fun set(
value: Int,
noinline block: T.(value: Int) -> Unit
): Unit
Set the value property of the emitted node.
Schedules block to be run when the node is first created or when value is different than the previous composition.
See Also
set
fun <V> set(
value: V,
block: T.(value: V) -> Unit
): Unit
Set the value property of the emitted node.
Schedules block to be run when the node is first created or when value is different than the previous composition.
See Also
update
inline fun update(
value: Int,
noinline block: T.(value: Int) -> Unit
): Unit
Update the value of a property of the emitted node.
Schedules block to be run when value is different than the previous composition. It is different than set in that it does not run when the node is created. This is used when initial value set by the ComposeNode in the constructor callback already has the correct value. For example, use [update} when value is passed into of the classes constructor parameters.
See Also
update
fun <V> update(
value: V,
block: T.