---
title: "Updater"
description: "A helper receiver scope class used by [ComposeNode] to help write code to initialized and update
a node."
type: "class"
---

<div class='type'>Class</div>


<a id='references'></a>

<div class='sourceset sourceset-common'>Common</div>


```kotlin
public value class Updater<T> constructor(@PublishedApi internal val composer: Composer)
```


A helper receiver scope class used by `ComposeNode` to help write code to initialized and update
a node.


## Functions

```kotlin
public 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.


```kotlin
public 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.


```kotlin
public 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.


```kotlin
public fun <V> update(value: V, block: T.(value: V) -> 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.


```kotlin
public fun init(block: T.() -> 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.


```kotlin
public fun <V> init(value: V, block: T.(V) -> 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.

This is different from the other `init` overload in that it does not force creating a lambda
to capture `value`.


```kotlin
public fun reconcile(block: T.() -> 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.



