LaunchedTask

fun LaunchedTask(block: suspend CoroutineScope.() -> Unit)

When LaunchedTask enters the composition it will launch block into the composition's CoroutineContext. The coroutine will be cancelled when the LaunchedTask leaves the composition.

To cancel and re-launch a task when input parameters change, see the overloads of LaunchedTask that accept additional key parameters.

fun LaunchedTask(key: Any?, block: suspend CoroutineScope.() -> Unit)

When LaunchedTask enters the composition it will launch block into the composition's CoroutineContext. The coroutine will be cancelled and re-launched when LaunchedTask is recomposed with a different key. The coroutine will be cancelled when the LaunchedTask leaves the composition.

This function should not be used to (re-)launch ongoing tasks in response to callback events by way of storing callback data in MutableState passed to key. Instead, see rememberCoroutineScope to obtain a CoroutineScope that may be used to launch ongoing jobs scoped to the composition in response to event callbacks.

fun LaunchedTask(key1: Any?, key2: Any?, block: suspend CoroutineScope.() -> Unit)
fun LaunchedTask(key1: Any?, key2: Any?, key3: Any?, block: suspend CoroutineScope.() -> Unit)
fun LaunchedTask(vararg keys: Any?, block: suspend CoroutineScope.() -> Unit)

When LaunchedTask enters the composition it will launch block into the composition's CoroutineContext. The coroutine will be cancelled and re-launched when LaunchedTask is recomposed with a different key. The coroutine will be cancelled when the LaunchedTask leaves the composition.

This function should not be used to (re-)launch ongoing tasks in response to callback events by way of storing callback data in MutableState passed to key. Instead, see rememberCoroutineScope to obtain a CoroutineScope that may be used to launch ongoing jobs scoped to the composition in response to event callbacks.