Questions tagged [kodein]

For questions regarding the libraries of the Kodein Framework (a Kotlin/Multiplatform architecture component framework). Questions should specify which library is being asked about (DI, DB, Log, etc.) as well as the source-set in which the problem occurs (Android, Native, Common, etc.).

The Kodein Framework

The Kodein Framework provides several libraries that can be used independently or together. Each provides an opinionated architecture component to ease and accelerate Kotlin/Multiplatform applications.

Links:

Tag usage

When posting questions about Kodein libraries, please make sure to include:

  • The source-set where the issue arises (common, intermediate, platform).
  • The target system & compiler (Android, JVM, JS, Native).
  • Kotlin version.
89 questions
0
votes
1 answer

Kodein constructor injecting Kodein$NotFoundException

For some reason I can't get constructor injection to work with Kodein. This is the code to reproduce the exception: import org.kodein.di.Kodein import org.kodein.di.direct import org.kodein.di.generic.bind import…
Jan Wytze
  • 3,307
  • 5
  • 31
  • 51
0
votes
1 answer

How to Rebind the Module at secound time called in kodein?

I have an android app, its developed in kotlin, also we use kodein dependence for binding the data.When the binding the data first time it will bind correctly but it does not bind at second time call. inner class CallmyClass() :…
0
votes
0 answers

How to call methods which type are return Module using Kotlin?

I have a two files one.kt and two.kt, i have innerclass in one.kt file. i want to call the that inner class when some action performed like button click in Two.kt file. I tried some of ways the innerclass is called but method does not call. please…
0
votes
1 answer

Shutting down / Closing Kodein context

Say in my application I maintain a few Kodein contexts and there are some shared resources in the Kodein contexts which I would like to close when the context it belongs to is no longer needed. Below is a simple illustration of the problem: class…
Daniel Cheng
  • 820
  • 5
  • 14
0
votes
1 answer

Passing object instance to constructor using Kodein

I'm new to Kotlin and Kodein. I'm trying to use a Java library and I need to pass a singleton to one of my constructors. I can't figure out how to get an actual instance. Since I need to pass an instance to the constructor I believe I need to be…
Brian DiCasa
  • 9,369
  • 18
  • 65
  • 97
0
votes
2 answers

How to override dependency into real kodein app dependency graph?

I'm trying to make some tests and i need to replace the real dependency by a fake one by overriding it on KODEIN but it's not working and i don't know what i can do anymore. Here is my dependency graph (I'm omitting others dependencies): class…
Rodrigohsb
  • 11
  • 3
0
votes
1 answer

How to get a list of bound singleton instances of one type?

Given a kodein instance: interface SharedInterface {} class A : SharedInterface class B : SharedInterface class C : SharedInterface class D fun main(args: Array) { val kodein = Kodein { bind() with singleton { A() } …
atok
  • 5,880
  • 3
  • 33
  • 62
0
votes
1 answer

Is it possible to bind a class member in kodein?

There is 2 classes: A - base class B - class of member of A with implementation something like this: class A { val b : B = B() } class B Problem Is it possible to create a binding for b to hide redundant info about b source in common…
Krystian Kaniowski
  • 1,959
  • 17
  • 33
0
votes
1 answer

kodein - data's value injected are not data's value retrieve

In my CallType class, i put my injected data connectivityState.callBackState to true, which is initialized to false in my ConnectivitySte class. But in my IncomingCallBroadcastReceiver class, my boolean data callBackState is not true but…
Halima
  • 5
  • 1
0
votes
1 answer

kodein, inject data to simple class

i'm new on kotlin and kodein development. I want to inject data to a simple class which extends nothing. I have my MainActivity which extends KodeinAppCompatActivity(), my fragment which extends KodeinSupportFragment() calls a function from my…
Halima
  • 5
  • 1
0
votes
2 answers

Kodein factory bindings is throwing NotFoundException

I don't know if this is a bug or I'm just doing it wrong. I see nothing in the documentation that says that kodein factory bindings should be called in any way other than this: class KodeinConfidenceTest { @Test fun testThatKodeinWorks() { …
Anarchofascist
  • 474
  • 5
  • 15
0
votes
1 answer

How to do multibinding using Kodein dependency retrieval container?

I do migration from Dagger 2 to Kodein and want good alternative to multibinding feature. Is there one?
I60R
  • 467
  • 2
  • 14
-2
votes
1 answer

by instance() showing red line in android studio after updating android studio 4 in kotlin

by instance() showing red line after updating android studio 4 private val factory: SelectHospitalViewModelFactory by instance()
Sunil Kumar
  • 127
  • 2
  • 8
1 2 3 4 5
6