Jayaprakash Mara
Jayaprakash Mara

Reputation: 323

How to resolve dependencies for a variable from a specific koin module?

I'm currently using Koin v1.0.1 and according to the documentation https://insert-koin.io/docs/1.0/documentation/reference/index.html#_koin_dsl (Section 2.11), I can give a module path:

module("org.sample")

and resolve the dependencies from a specific module with inject:

// Request dependency from /org/sample namespace
val service : Service by inject(module = "org.sample")

However, I see that the inject method doesn't accept module path in the argument anymore. Can someone help me with this problem.

I also came across a easy way to get the module name with moduleName property:

UserSession::class.moduleName

But I cannot find it in Kotlin 1.2.71. Am I missing something here?

Upvotes: 1

Views: 516

Answers (1)

Loïc
Loïc

Reputation: 363

Unfortunately, it seems that the "module" property does not exist anymore. You can use "name" instead.

https://github.com/InsertKoinIO/koin/issues/257

Upvotes: 0

Related Questions