report
Reports progress to the progress reporter stored in the currentCoroutineContext.
If there is no progress reporter in the current context, this function does nothing.
Example
suspend fun main() {
reportProgress(::println) {
task1()
}
}
suspend fun task1() {
report(loading(0.0))
delay(500)
report(loading(0.5))
delay(500)
report(done())
}
Content copied to clipboard
Loading(0%)
Loading(50%)
Done
Content copied to clipboard