I have multiple expect/actual constructs in my kotlin multiplatform project. There exists one problem with the ProfileProvider. Here is my setup.
The commonMain source set holds the expect class ProfileProvider.kt:
interface IProfileProvider {
val profile: MutableStateFlow<Profile?>
fun reloadProfile()
}
expect class ProfileProvider: IProfileProvider
And the androidMain source set holds the ProfileProvider.android.kt:
actual class ProfileProvider(
private val authProvider: AuthProvider,
private val userRepository: UserRepository,
private val fileRepository: FileRepository,
defaultDispatcher: CoroutineDispatcher,
private val context: Context
): IProfileProvider {
private var _profile = MutableStateFlow<Profile?>(null)
override val profile = _profile
...
}
In the ProfileProvider.kt my expect declaration expect class ProfileProvider: IProfileProvider
is marked as error with the message ProfileProvider: expect and corresponding actual are declared in the same module.
Does anybody know why? I guess my project configuration might be wrong since I have a single module called app that contains androidMain, commonMain and iosMain source sets. Is this error message targeting source sets or modules? Hope anyone can clearify.
My project configuration actually was wrong, but I cannot say to what extend. After recreating the multi module project with intellij's wizard, the expect/actual declarations are properly used and the error disappeard.