doOnDestroy

A convenience function that calls onDestroy when the LifecycleOwner is destroyed.

It returns the LifecycleObserver registered internally, allowing callers to unregister it earlier if desired. Otherwise it will automatically be removed upon destroying.


A convenience function that calls onDestroy when the Lifecycle is destroyed.

It returns the LifecycleObserver registered internally, allowing callers to unregister it earlier if desired. Otherwise it will automatically be removed upon destroying.