-
public final class MavericksLifecycleAwareFlowKt
-
-
Method Summary
Modifier and Type Method Description final static <T extends Any> Flow<T>flowWhenStarted(Flow<T> $self, LifecycleOwner owner)Emits values from the source flow only when the owner is started. -
-
Method Detail
-
flowWhenStarted
final static <T extends Any> Flow<T> flowWhenStarted(Flow<T> $self, LifecycleOwner owner)
Emits values from the source flow only when the owner is started. When the owner transitions to started, the most recent value will be emitted.
Implementation is similar to combineTransform with the following changes:
Regular channels are used instead of fair channels to avoid unnecessary yield calls. It's possible because lifecycle state updated in the main thread
Flow completes when either this flow completes or lifecycle is destroyed
-
-
-
-