ActiveWhileStarted

fun ActiveWhileStarted(vararg restartKeys: Any?, enabled: Boolean = true, effect: () -> () -> Unit)(source)

Runs effect while the current lifecycle is at least STARTED and enabled is true.

Changing a restartKeys value restarts an active effect. The returned cleanup callback is invoked synchronously on ON_STOP, disable, or composition disposal. If that callback cancels coroutine work, downstream cleanup such as a callbackFlow provider's awaitClose runs as cancellation resumes.