Phuc
06/08/2024, 4:43 AMUncaught Kotlin exception: kotlin.UnsupportedOperationException: `Factory.create(String, CreationExtras)` is not implemented. You may need to override the method and provide a custom implementation. Note that using `Factory.create(String)` is not supported and considered an error.
Phuc
06/08/2024, 4:43 AMPhuc
06/08/2024, 4:43 AMPablichjenkov
06/08/2024, 5:08 AMinitialize {}
lambdaPhuc
06/08/2024, 5:09 AMfun MyComposable(viewModel: MyViewModel = viewModel { MyViewModel() })
like this right? I just changed to this and it is working nowPhuc
06/08/2024, 5:10 AMfun MyComposable(viewModel: MyViewModel = viewModel())
Phuc
06/08/2024, 5:11 AMPablichjenkov
06/08/2024, 5:15 AMviewModel()
function doesn't know how to create your ViewModel unless you tell it how to, with the initializer parameter.
You can use koin in the meantime. It has support for that already.Phuc
06/08/2024, 5:19 AMPhuc
06/08/2024, 5:19 AMPhuc
06/08/2024, 5:20 AMPablichjenkov
06/08/2024, 5:32 AMthat has no constructor parameters
using reflection. But outside JVM this is not possible.
Koin is a DI library, it offers first class support for compose multiplatform, worth checking