https://kotlinlang.org logo
#koin
Title
# koin
v

Vivek Modi

07/19/2022, 10:55 AM
Hey guys, I am using koin compose in my project. I see the example of sample-compose from koin repository. I am getting weird issue on
viewModelOf
Copy code
package com.vivek.sportsresult.di

import org.koin.androidx.viewmodel.dsl.viewModelOf
import org.koin.dsl.module

val appModule = module {
    viewModelOf(::MainActivityViewModel)
}
Can someone how can I fix this error.
Error is too big so I am adding small description
None of the following functions can be called with the arguments supplied.
MainActivityViewModel.kt
Copy code
package com.vivek.sportsresult.viewmodel

import androidx.lifecycle.ViewModel

class MainActivityViewModel : ViewModel() {
}
Copy code
implementation "io.insert-koin:koin-android:$koin_version"

implementation "io.insert-koin:koin-androidx-compose:$koin_version"
koin 3.2.0
a

arnaud.giuliani

07/19/2022, 11:29 AM
be sure to use the right import from
org.koin.androidx.viewmodel.dsl
v

Vivek Modi

07/19/2022, 11:30 AM
I used this import
Copy code
import org.koin.androidx.viewmodel.dsl.viewModelOf
import org.koin.dsl.module
but still have problem
a

arnaud.giuliani

07/19/2022, 11:42 AM
can you just add
()
as empty constructor? 🤔
v

Vivek Modi

07/19/2022, 11:45 AM
Now I am getting this error on
()
😭
This syntax is reserved for future use; to call a reference, enclose it in parentheses: (foo::bar)(args)
I added my project in github https://github.com/vivek-modi/SportsResult
Never mind I fix the issue
a

arnaud.giuliani

07/19/2022, 3:21 PM
ok 👍
👍 2
m

miqbaldc

07/25/2022, 12:15 AM
what causing it? @Vivek Modi
v

Vivek Modi

07/25/2022, 7:17 AM
I didn't import it my viewmodel
🙏 1
15 Views