useFlowWithLifecycle

fun <T> ComponentScope.useFlowWithLifecycle(stateFlow: StateFlow<T>, minActiveState: Lifecycle.State = Lifecycle.State.RESUMED): T

Returns the current value of a given stateFlow.

This StateFlow is collected on the CoroutineScope given by getTreeProp as long as the Lifecycle is at the minActiveState state, and collection pauses when the Lifecycle falls below minActiveState. The collection is canceled when this component is detached.