LifecycleEventEffect
Schedule an effect to run when the Lifecycle receives a specific Lifecycle.Event.
Using a Lifecycle.Observer to listen for when LifecycleEventEffect enters the composition, onEvent will be launched when receiving the specified event.
This function should not be used to listen for Lifecycle.Event.ON_DESTROY because Compose stops recomposing after receiving a Lifecycle.Event.ON_STOP and will never be aware of an ON_DESTROY to launch onEvent.
This function should also not be used to launch tasks in response to callback events by way of storing callback data as a Lifecycle.State in a MutableState. Instead, see currentStateAsState to obtain a State
Parameters
The Lifecycle.Event to listen for
The lifecycle owner to attach an observer
The effect to be launched when we receive an event callback
Throws
if attempting to listen for Lifecycle.Event.ON_DESTROY