tseisel
08/08/2020, 7:56 AMsuspend fun doWork(progress: (Progress) -> Unit)
2️⃣ fun doWork(): Flow<Progress>
3️⃣ fun doWorkIn(scope: CoroutineScope): StateFlow<Progress>
4️⃣ Anything else (please explain in comments !)gildor
08/08/2020, 10:58 AMErik
08/08/2020, 11:12 AMProgress
could be a sealed class where it's either partially done, or the completed result (or even an error if that is a result). That would play nicely with option 2, so you can collect progress updates and ultimately the flow completes with a result or error.gildor
08/09/2020, 5:51 AMd4vidi
08/09/2020, 8:07 AMsuspend
and a callback seems like a paradigm collision.bezrukov
08/09/2020, 8:57 AMflow.collect
signature? 🙂 You will pass callback in both 1️⃣ and 2️⃣gildor
08/09/2020, 3:39 PMd4vidi
08/10/2020, 9:59 AM