ProgressReportingLoader
Interface for loaders that support progress reporting.
Consuming applications can collect the progress flow to receive updates during loading operations. The flow uses SharedFlow internally, supporting multiple collectors.
This interface is optional - loaders that don't need progress reporting don't need to implement it.
Usage:
val loader: ProgressReportingLoader = ...
// Start collecting before loading
val progressJob = scope.launch {
loader.progress.collect { progress ->
updateUI(progress)
}
}
// Perform load operation
val result = loader.load(...)
// Cancel collection when done
progressJob.cancel()Content copied to clipboard