startCoroutine

Common
JVM
JS
Native
1.3
fun <T> (suspend () -> T).startCoroutine(
    completion: Continuation<T>)

Starts a coroutine without a receiver and with result type T. This function creates and starts a new, fresh instance of suspendable computation every time it is invoked. The completion continuation is invoked when the coroutine completes with a result or an exception.

Common
JVM
JS
Native
1.3
fun <R, T> (suspend R.() -> T).startCoroutine(
    receiver: R,
    completion: Continuation<T>)

Starts a coroutine with receiver type R and result type T. This function creates and starts a new, fresh instance of suspendable computation every time it is invoked. The completion continuation is invoked when the coroutine completes with a result or an exception.