Interface

ObservationTarget

A target of snapshot read observation, passed to ComposeUiHost.observeReads.

Source set: Common
public interface ObservationTarget

A target of snapshot read observation, passed to ComposeUiHost.observeReads.

Hosts that observe reads on behalf of a Compose hierarchy can use isObservationValid to discard observations whose target has been removed, for example with SnapshotStateObserver.clearIf { !(it as ObservationTarget).isObservationValid }.

Properties

isObservationValid

Source set: Common
public val isObservationValid: Boolean

true while the target is part of the hierarchy. false once it has been removed, after which its observations are no longer needed and can be discarded.

Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: