onDispose

abstract fun onDispose(callback: () -> 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

A callback to be executed when this CommitScope leaves the composition.