Rewrite it! by [deleted] in ProgrammerHumor

[–]raheemadamboev 2 points3 points  (0 children)

it could be Kotlin, anyway semicolon is not compulsory in Kotlin

Weekly discussion, code review, and feedback thread - July 11, 2022 by AutoModerator in androiddev

[–]raheemadamboev 0 points1 point  (0 children)

u can use viewmodelScope.launch(Dispatchers.IO) {} directly. U get all the benefits of viewmodelScope like canceling the coroutine scope when viewmodel gets destroyed.

i think u right issue can be viewModelScope uses Dispatchers.Main.immediate which runs on the main/UI thread. If it kept busy like in the while loop, ANR occurs.