commonMain.StateFlowProgressReporter.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of progress-coroutines Show documentation
Show all versions of progress-coroutines Show documentation
Coroutine-aware universal progress representation
The newest version!
package opensavvy.progress.coroutines
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import opensavvy.progress.Progress
import opensavvy.progress.loading
import opensavvy.progress.report.ProgressReporter
/**
* [ProgressReporter] implementation which stores the latest progress information in [progress], a [StateFlow].
*/
class StateFlowProgressReporter : ProgressReporter {
private val state = MutableStateFlow