Sync Over Async (ARCH8023)
Esta página aún no está disponible en tu idioma.
Key kotlin.async.sync-over-async · Severity error · Category async
Flags runBlocking outside main functions, tests and blocking framework contracts (Interceptor.intercept) - it blocks the calling thread on a coroutine and deadlocks single-threaded dispatchers.
Incorrect
Section titled “Incorrect”fun load(): User = runBlocking { repository.load() }Correct
Section titled “Correct”suspend fun load(): User = repository.load()Make the caller suspend, or bridge at the outermost edge only (main, a test, a framework callback that offers no suspension).