createScopeWithContext

inline fun createScopeWithContext(crossinline contextProvider: CoroutineContextProvider = { EmptyCoroutineContext }, supervised: Boolean = false): CoroutineScope

Creates a CoroutineScope with the given CoroutineContext and optional SupervisorJob.

Return

A CoroutineScope with the combined context.

Parameters

contextProvider

A function that provides the CoroutineContext to be used for the scope.

supervised

Whether to add a SupervisorJob to the coroutine context.