currentCoroutineContext

Returns the current CoroutineContext retrieved by using kotlin.coroutines.coroutineContext. This function is an alias to avoid name clash with CoroutineScope.coroutineContext in a receiver position:

launch { // this: CoroutineScope
val flow = flow<Unit> {
coroutineContext // Resolves into the context of outer launch, which is incorrect, see KT-38033
currentCoroutineContext() // Retrieves actual context where the flow is collected
}
}