LifecycleKt

Added in 2.2.0

public final class LifecycleKt


Summary

Public methods

static final @NonNull LifecycleCoroutineScope

CoroutineScope tied to this Lifecycle.

static final @NonNull Flow<@NonNull Lifecycle.Event>

Creates a Flow of Lifecycle.Events containing values dispatched by this Lifecycle.

Public methods

getCoroutineScope

public static final @NonNull LifecycleCoroutineScope getCoroutineScope(@NonNull Lifecycle receiver)

CoroutineScope tied to this Lifecycle.

This scope will be cancelled when the Lifecycle is destroyed.

This scope is bound to Dispatchers.Main.immediate

public static final @NonNull Flow<@NonNull Lifecycle.EventgetEventFlow(@NonNull Lifecycle receiver)

Creates a Flow of Lifecycle.Events containing values dispatched by this Lifecycle.