launchMolecule

fun <T> CoroutineScope.launchMolecule(clock: RecompositionClock, body: @Composable () -> T): StateFlow<T>

Launch a coroutine into this CoroutineScope which will continually recompose body to produce a StateFlow stream of T values.


fun <T> CoroutineScope.launchMolecule(clock: RecompositionClock, emitter: (value: T) -> Unit, body: @Composable () -> T)

Launch a coroutine into this CoroutineScope which will continually recompose body to invoke emitter with each returned T value.

launchMolecule's emitter is always free-running and will not respect backpressure. Use moleculeFlow to create a backpressure-capable flow.