CommitScope
Kotlin
|Java
interface CommitScope
androidx.compose.CommitScope |
A CommitScope represents an object that executes some code and has a cleanup in the context of the Composition lifecycle. It has an "onDispose" operation to cleanup anything that it created whenever it leaves the composition.
Summary
Public methods |
|
---|---|
abstract Unit |
Provide a lambda which will be executed as this CommitScope leaves the composition. |
Public methods
onDispose
abstract fun onDispose(callback: () -> Unit): Unit
Provide a lambda which will be executed as this CommitScope leaves the composition. It will be executed only once. Use this to schedule cleanup for anything that you construct during the CommitScope's creation.
Parameters | |
---|---|
callback: () -> Unit | A callback to be executed when this CommitScope leaves the composition. |