{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

DisposableEffectScope

public final class DisposableEffectScope


Receiver scope for DisposableEffect that offers the onDispose clause that should be the last statement in any call to DisposableEffect.

Summary

Public constructors

Public methods

final @NonNull DisposableEffectResult
onDispose(@NonNull Function0<Unit> onDisposeEffect)

Provide onDisposeEffect to the DisposableEffect to run when it leaves the composition or its key changes.

Public constructors

DisposableEffectScope

public DisposableEffectScope()

Public methods

onDispose

public final @NonNull DisposableEffectResult onDispose(@NonNull Function0<Unit> onDisposeEffect)

Provide onDisposeEffect to the DisposableEffect to run when it leaves the composition or its key changes.