ObserverModifierNode


Modifier.Nodes that implement ObserverNode can provide their own implementation of onObservedReadsChanged that will be called in response to changes to snapshot objects read within an observeReads block.

Summary

Public functions

Unit

This callback is called when any values that are read within the observeReads block change.

Cmn

Extension functions

Unit

Use this function to observe snapshot reads for any target within the specified block.

Cmn

Inherited functions

From androidx.compose.ui.node.DelegatableNode
open Unit

Invoked when the density changes for this node.

Cmn
open Unit

Invoked when the layout direction changes for this node.

Cmn

Inherited properties

From androidx.compose.ui.node.DelegatableNode
Modifier.Node

A reference of the Modifier.Node that holds this node's position in the node hierarchy.

Cmn

Public functions

onObservedReadsChanged

fun onObservedReadsChanged(): Unit

This callback is called when any values that are read within the observeReads block change. It is called after the snapshot is committed. onObservedReadsChanged is called on the UI thread, and only called once in response to snapshot observation. To continue observing further updates, you need to call observeReads again.

Extension functions

T.observeReads

fun <T : Modifier.Node & ObserverModifierNode> T.observeReads(block: () -> Unit): Unit

Use this function to observe snapshot reads for any target within the specified block. ObserverModifierNode.onObservedReadsChanged is called when any of the observed values within the snapshot change.