events
Create a Flow of Lifecycle.Events on the Lifecycle instance.
Note: Created flow keeps a strong reference to the Lifecycle instance until the coroutine that launched the flow collector is cancelled.
Example of usage:
lifecycle.events()
.filter { it == Lifecycle.Event.ON_CREATE }
.onEach { event ->
// handle Lifecycle.Event.ON_CREATE event
}
.launchIn(uiScope)
Content copied to clipboard