dan0

joined 1 year ago
[–] dan0@programming.dev 2 points 1 year ago

For the dispatchers, the docs do a better job explaining then I should try to give, but in short IO is optimized for long running operations, whereas Default is optimized for running more intensive computations.

For the lifecycle scope that's basically it. Fragments, Activities, and ViewModels all have their own variants of this. It's almost always bad practice to have a coroutine not scoped to some form of lifecycle or you could easily end up with a bunch of memory leaks and unreported issues (https://kotlinlang.org/docs/coroutines-basics.html#structured-concurrency).

[–] dan0@programming.dev 0 points 1 year ago (2 children)

I would make sure to use the IO dispatcher instead and probably a lifecycle scope.

[–] dan0@programming.dev 2 points 1 year ago

That's true, but does your answer on SO pay the bills for running and serving the content?

 

With more people hopefully coming over from Reddit, I wanted to give some visibility to Jerboa. This is an Android app for Lemmy, written in Compose.