Hi! I need a bit of help understanding the IO talk on Coroutines. At this point in the talk (see the link) they have a code sample which shouldn't compile. And even if it compiled, I don't see how it would work across a
lifecycleScope
cancellation.
What code did they have in mind? How does it work? Many thanks.
https://youtu.be/BOHK_w09pVA?t=1719▾
e
elizarov
05/11/2019, 7:43 PM
Its a code snippet, not a complete sample. The launch was supposed to happen from some function.
v
voddan
05/11/2019, 8:13 PM
1) Was it important what function it was?
onCreate
or any other?
voddan
05/11/2019, 8:14 PM
2) How does it work with constant interactions from the canceling? I believe that was the problem they were discussing
voddan
05/11/2019, 8:15 PM
I wish I could run their code and see for myself how it is working 🙂 Otherwise an excellent talk
g
gildor
05/14/2019, 3:28 AM
You can run from a function where you want to start this coroutine, you can do this from
init {}
block or by request by exposing some function
gildor
05/14/2019, 3:29 AM
actually, this code make sense only if you do this by request, if you just want to load data on ViewModel creation easier use