Usage of viewModelScope crashes on Desktop
warcello opened this issue · comments
Hi, I noticed that my Desktop app is crashing because I used the viewModelScope provided by PreCompose.
The Error is IllegalStateException with message:
"Module with the Main dispatcher is missing. Add dependency providing the Main dispatcher, e.g. 'kotlinx-coroutines-android' and ensure it has the same version as 'kotlinx-coroutines-core'"
If it needs some additional setup for desktop then it should be mentioned in the documentation however I didn't need to add anything for Android or iOS so I guess that it should be the same for other platforms.
Ok, nevermind, I found out that it is rather a problem with Dispatchers.Main as it stopped to be supported in compose multiplatform since version 1.1.1
https://github.com/JetBrains/compose-multiplatform/releases/tag/v1.1.1