doInIO

inline suspend fun <T> doInIO(noinline block: suspend CoroutineScope.() -> T): T(source)

Executes the given block on the IO dispatcher and returns its result. This is a convenience function for executing I/O-bound operations like reading files, network requests, or database queries.

Return

The result of executing the block

Parameters

block

The suspending function to execute on the IO dispatcher

Type Parameters

T

The return type of the block