Home > database >  None of the following functions can be called with the arguments supplied on koin in jetpack compose
None of the following functions can be called with the arguments supplied on koin in jetpack compose

Time:07-19

I am using koin v3.2.0 in my jetpack compose application. I am getting weird issue on my viewModelOf. I imported correctly as well from the enter image description here

Error is too big I am short description.

one of the following functions can be called with the arguments supplied.
Module.viewModelOf(() → TypeVariable(R))   where R = TypeVariable(R) for    inline fun <reified R : ViewModel> Module.viewModelOf(crossinline constructor: () → R): KoinDefinition<R> /* = Pair<Module, InstanceFactory<R>> */ defined in org.koin.androidx.viewmodel.dsl

Can somone guide me please. My Project on Github Thanks

CodePudding user response:

Inside your AppModule.kt import this:

import com.vivek.sportsresult.viewmodel.MainActivityViewModel

Your new AppModule.kt:

package com.vivek.sportsresult.di

import com.vivek.sportsresult.viewmodel.MainActivityViewModel
import org.koin.androidx.viewmodel.dsl.viewModelOf
import org.koin.dsl.module

val appModule = module {
    viewModelOf(::MainActivityViewModel)
}
  • Related