Abhimanyu
10/02/2024, 6:26 PMMárton Braun
.
Does this mean async
is always preferred over launch
even when fire and forget works for my functionality?
https://kotlinlang.slack.com/files/UPQU769PU/F07Q66B5WAG/image.png▾
https://kotlinlang.slack.com/files/UPQU769PU/F07QGBQLUUR/image.png▾
Sam
10/02/2024, 6:31 PMSam
10/02/2024, 6:33 PMAbhimanyu
10/02/2024, 6:34 PMviewModelScope.launch { }
.
When using StandardTestDispatcher
, I am not sure how to launch the coroutines.blakelee
10/02/2024, 6:44 PMAbhimanyu
10/02/2024, 6:45 PMlaunch
or async
. That's why I found this situation a bit confusing.
I'm trying to understand if there's anything else I should consider when making the choice.blakelee
10/02/2024, 6:55 PMAbhimanyu
10/02/2024, 6:57 PMreturn viewModelScope.launch {}
, I am not sure how that helps.
This is the actual issue - https://kotlinlang.slack.com/archives/C1CFAFJSK/p1727888646418719.blakelee
10/02/2024, 7:02 PMUnconfinedTestDispatcher
and I was able to launch stuff with the backgroundScope
. Would it make sense to break up the two different launches into separate functions so that you can use call them for tests?Abhimanyu
10/02/2024, 7:04 PMprivate
.
I would prefer not to expose them just for testing.Abhimanyu
10/02/2024, 7:05 PM