reportProgress

suspend fun reportProgress(onProgress: (Progress) -> Unit, block: suspend () -> Unit)(source)

Captures all calls to report in block and transmits them to onProgress.

Example

suspend fun main() {
// Function reference syntax
reportProgress(::println) {
// All 'report' calls in this block will be printed
someComplicatedTask()
}

// Lambda syntax
reportProgress({ println(it) }) {
someComplicatedTask()
}
}