Cancels the operation that this handle was returned for. Implementations of this method should be idempotent. Callers should be able to cancel the same handle a second time without causing any externally visible effects.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-08-27 UTC.
[null,null,["Last updated 2025-08-27 UTC."],[],[],null,["# CancellationHandle\n==================\n\nArtifact: [androidx.compose.runtime:runtime](/jetpack/androidx/releases/compose-runtime) \n[View Source](https://cs.android.com/search?q=file:androidx/compose/runtime/CancellationHandle.kt+class:androidx.compose.runtime.CancellationHandle) \nAdded in [1.10.0-alpha01](/jetpack/androidx/releases/compose-runtime#1.10.0-alpha01)\nCommon/AllAndroid/JVMNative/C/iOSJavaScript\n - Cmn \n\n ```\n fun interface CancellationHandle\n ```\n\n*** ** * ** ***\n\nImplementations of this interface can be used to cancel an ongoing operation or unregister a listener by calling [cancel](/reference/kotlin/androidx/compose/runtime/CancellationHandle#cancel()).\n\nSummary\n-------\n\n| ### Public functions |\n|-------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------|-----|\n| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [cancel](/reference/kotlin/androidx/compose/runtime/CancellationHandle#cancel())`()` Cancels the operation that this handle was returned for. | Cmn |\n\nPublic functions\n----------------\n\n### cancel\n\nCmn \nAdded in [1.10.0-alpha01](/jetpack/androidx/releases/compose-runtime#1.10.0-alpha01) \n\n```\nfun cancel(): Unit\n```\n\nCancels the operation that this handle was returned for. Implementations of this method should be idempotent. Callers should be able to cancel the same handle a second time without causing any externally visible effects."]]