destroy
Cleans up the Experience when no longer in use, releasing the resources it holds.
Call this exactly where the view's own lifetime ends, which is not always where the surrounding screen's does:
Views and Fragments: pass the host LifecycleOwner's lifecycle to androidx.lifecycle.Lifecycle.addObserver and this is called for you on
ON_DESTROY.Compose: call it from
AndroidView'sonRelease, the counterpart to thefactorythat created the view. ADisposableEffectis scoped to the composable, so it will not fire when theAndroidViewalone leaves the composition: inside anif, a lazy list, or a dialog that is dismissed while its screen stays put.
Safe to call more than once; subsequent calls are ignored. The view cannot be reused afterwards.