I am facing this weird error My iOS app is crashin...
# koin
v
I am facing this weird error My iOS app is crashing on Koin 4.0.4, even tho my dependencies are correctly declared in the module Chat Gpt says its a deadlock in koin Stack trace in thread
1
I even tried changing List<Tracker> to a data class which holds this list in it, it still crashes
This is where the error is
Copy code
object Analytics : KoinComponent {

    private val trackers by inject<List<Tracker>>()
Now if i remove this
inject
and make it a empty list
private val trackers = emptyList<Tracker>()
app works fine
Module
Copy code
single {
    val amplitude = Amplitude.instance().apply {
        initializeApiKey(AppConfig.AMPLITUDE_API_KEY)
        defaultTracking = AMPDefaultTrackingOptions().apply {
            sessions = true
            deepLinks = true
            appLifecycles = true
            screenViews = true
        }
    }
    AmplitudeTracker(amplitude)
}

single<List<Tracker>> {
    listOf(get<AmplitudeTracker>())
}
Update: instead of using
inject
I made it like this
Copy code
private var trackers = emptyList<Tracker>()
fun init(trackers: List<Tracker>) {
    this.trackers = trackers
}
and calling it from my RootComponent
Copy code
Analytics.init(getKoin().get<List<Tracker>>())
and it works 🫠
p
Making as answered ok