Hi! The following scenario is giving me trouble wi...
# koin
r
Hi! The following scenario is giving me trouble with Koin Annotations:
Copy code
// common
@Module(includes = [PlatformModule::class])
class CommonModule {
    @Single
    fun provideFoo(bar: Bar) = Foo(bar)
}

@Module
expect class PlatformModule()

// platform
@Module
actual class PlatformModule {
    @Single
    fun provideBar() = Bar()
}
If I have
KOIN_CONFIG_CHECK
enabled, this setup fails with "missing declaration for property bar". It works fine if
PlatformModule
is not an expect/actual declaration, and the expect/actual version is fine at runtime if I disable the check. Is this a known issue or should I file a ticket?
1
k
Hi @russhwolf, have you tried using the
@Provided
annotation on the commonModule i.e
Copy code
// common
@Module(includes = [PlatformModule::class])
class CommonModule {
    @Single
    fun provideFoo(@Provided bar: Bar) = Foo(bar)
}

@Module
expect class PlatformModule()

// platform
@Module
actual class PlatformModule {
    @Single
    fun provideBar() = Bar()
}
r
Yeah that's what I was missing. Thanks!
👍 1