What can I use instead of viewModel in wasm? as kn...
# compose-web
a
What can I use instead of viewModel in wasm? as know ViewModel from Jetpack doesn't support wasm
i
It's supported in last beta
a
Thanks. I didn't know
Copy code
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.8.0-beta01")
I added this dependency and got this error Could not resolve all dependencies for configuration 'composeAppwasmJsCompileClasspath'.
Could not resolve androidx.lifecyclelifecycle viewmodel compose2.8.0-beta01.
Required by: project :composeApp > No matching variant of androidx.lifecyclelifecycle viewmodel compose2.8.0-beta01 was found. The consumer was configured to find a library for use during 'kotlin-api', preferably optimized for non-jvm, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'wasm', attribute 'org.jetbrains.kotlin.wasm.target' with value 'js' but: - Variant 'androidxSourcesElements' capability androidx.lifecyclelifecycle viewmodel compose2.8.0-beta01:
i
org.jetbrains.androidx.lifecycle:lifecycle-viewmodel-compose:2.8.0-beta01
❤️ 1
a
Module "org.jetbrains.compose.foundation:foundation" has a reference to symbol org.jetbrains.skiko/SkikoKey.platformKeyCode.<get-platformKeyCode>|<get-platformKeyCode>(){}[0]. Neither the module itself nor its dependencies contain such declaration. This could happen if the required dependency is missing in the project. Or if there is a dependency of "org.jetbrains.compose.foundation:foundation" that has a different version in the project than the version that "org.jetbrains.compose.foundation:foundation" was initially compiled with. Please check that the project configuration is correct and has consistent versions of all required dependencies. Now I got this error. Do you know why ?
i
1. Version of compose.foundation != version of compose.ui 2. The binary compatibility was broken only in compose.ui 1.6.10-beta01 and was fixed in beta02 My advise here is to keep versions of these modules in sync even if they should be compatible between different ones
👍 1