Lifecycle
A holder of Lifecycle.State that can be observed for changes.
Possible transitions:
[INITIALIZED] ──┐(1)
↓
(6)┌── [CREATED] ────┐(2)
↓ ↑ (5) ↓
[DESTROYED] └──── [STARTED] ──┐(3)
↑ ↓
(4)└── [RESUMED]
(1): ON_CREATE
(2): ON_START
(3): ON_RESUME
(4): ON_PAUSE
(5): ON_STOP
(6): ON_DESTROY
Inheritors
Types
Defines the possible states of the Lifecycle.
Functions
Collects values from the Lifecycle.currentStateFlow and represents its latest value via State. The StateFlow.value is used as an initial value. Every time there would be new value posted into the StateFlow the returned State will be updated causing recomposition of every State.value usage.
Runs the given block in a new coroutine when this
Lifecycle is at least at state and suspends the execution until this
Lifecycle is Lifecycle.State.DESTROYED.
Run block with this Lifecycle in a Lifecycle.State of at least Lifecycle.State.CREATED and resume with the result. Throws the CancellationException if the lifecycle has reached Lifecycle.State.DESTROYED by the time of the call or before block is able to run.
Run block with this Lifecycle in a Lifecycle.State of at least Lifecycle.State.RESUMED and resume with the result. Throws the CancellationException if the lifecycle has reached Lifecycle.State.DESTROYED by the time of the call or before block is able to run.
Run block with this Lifecycle in a Lifecycle.State of at least Lifecycle.State.STARTED and resume with the result. Throws the CancellationException if the lifecycle has reached Lifecycle.State.DESTROYED by the time of the call or before block is able to run.
Run block with this Lifecycle in a Lifecycle.State of at least state and resume with the result. Throws the CancellationException if the lifecycle has reached Lifecycle.State.DESTROYED by the time of the call or before block is able to run.