startCoroutine

fun <T> suspend () -> T.startCoroutine(completion: Continuation<T>)(source)

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.

Since Kotlin

1.3

fun <R, T> suspend R.() -> T.startCoroutine(receiver: R, completion: Continuation<T>)(source)

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.

Since Kotlin

1.3