LifecycleKt
public final class LifecycleKt
Summary
Public methods |
|
|---|---|
static final @NonNull LifecycleObserver |
addObserver(Add a |
static final @NonNull LifecycleCoroutineScope |
getCoroutineScope(@NonNull Lifecycle receiver)
|
static final @NonNull Flow<@NonNull Lifecycle.Event> |
getEventFlow(@NonNull Lifecycle receiver)Creates a |
Public methods
addObserver
public static final @NonNull LifecycleObserver addObserver(
@NonNull Lifecycle receiver,
@NonNull Function3<@NonNull LifecycleObserver, @NonNull LifecycleOwner, @NonNull Lifecycle.Event, Unit> action
)
Add a LifecycleObserver to this Lifecycle using the provided action.
| Parameters | |
|---|---|
@NonNull Function3<@NonNull LifecycleObserver, @NonNull LifecycleOwner, @NonNull Lifecycle.Event, Unit> action |
The action that will be invoked whenever a |
| Returns | |
|---|---|
@NonNull LifecycleObserver |
the |
getCoroutineScope
public static final @NonNull LifecycleCoroutineScope getCoroutineScope(@NonNull Lifecycle receiver)
CoroutineScope tied to this Lifecycle.
This scope will be canceled when the Lifecycle is destroyed.
This scope is bound to Dispatchers.Main.immediate
getEventFlow
public static final @NonNull Flow<@NonNull Lifecycle.Event> getEventFlow(@NonNull Lifecycle receiver)
Creates a Flow of Lifecycle.Events containing values dispatched by this Lifecycle.