# DisposableEffectScope

Artifact: [androidx.compose.runtime:runtime](https://developer.android.com/jetpack/androidx/releases/compose-runtime) [View Source](https://cs.android.com/search?q=file:androidx/compose/runtime/Effects.kt+class:androidx.compose.runtime.DisposableEffectScope) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-runtime#1.0.0) Common/AllAndroid/JVMNative/C/iOSJavaScript
- Cmn

  ```
  class DisposableEffectScope
  ```

*** ** * ** ***

Receiver scope for `https://developer.android.com/reference/kotlin/androidx/compose/runtime/DisposableEffect.composable#DisposableEffect(kotlin.Function1)` that offers the `https://developer.android.com/reference/kotlin/androidx/compose/runtime/DisposableEffectScope#onDispose(kotlin.Function0)` clause that should be the last statement in any call to `https://developer.android.com/reference/kotlin/androidx/compose/runtime/DisposableEffect.composable#DisposableEffect(kotlin.Function1)`.

## Summary

| ### Public constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/DisposableEffectScope#DisposableEffectScope()()` | Cmn |

| ### Public functions |
|---|---|---|
| `inline https://developer.android.com/reference/kotlin/androidx/compose/runtime/DisposableEffectResult` | `https://developer.android.com/reference/kotlin/androidx/compose/runtime/DisposableEffectScope#onDispose(kotlin.Function0)(crossinline onDisposeEffect: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)` Provide `https://developer.android.com/reference/kotlin/androidx/compose/runtime/DisposableEffectScope#onDispose(kotlin.Function0)` to the `https://developer.android.com/reference/kotlin/androidx/compose/runtime/DisposableEffect.composable#DisposableEffect(kotlin.Function1)` to run when it leaves the composition or its key changes. | Cmn |

## Public constructors

### DisposableEffectScope

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-runtime#1.0.0)

```
DisposableEffectScope()
```

## Public functions

### onDispose

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-runtime#1.0.0)

```
inline fun onDispose(crossinline onDisposeEffect: () -> Unit): DisposableEffectResult
```

Provide `https://developer.android.com/reference/kotlin/androidx/compose/runtime/DisposableEffectScope#onDispose(kotlin.Function0)` to the `https://developer.android.com/reference/kotlin/androidx/compose/runtime/DisposableEffect.composable#DisposableEffect(kotlin.Function1)` to run when it leaves the composition or its key changes.