https://kotlinlang.org logo
Title
b

Baudouin

05/06/2023, 8:51 PM
Hi ! I'm a beginner in Jetpack Compose and i tried to use 2 viewmodel il my app with a datastore an room. But i got a issue with
private const val INFORMATIONS_PREFERENCE_NAME = "user_informations"
private val Context.dataStore: DataStore<Preferences> by preferencesDataStore(
    name = INFORMATIONS_PREFERENCE_NAME
)

class BobApplication : Application() {
    lateinit var userInformationsRepository: UserInformationsRepository
    lateinit var notesRepository: NotesRepository

    override fun onCreate() {
        super.onCreate()
        userInformationsRepository = UserInformationsRepository(dataStore)
        notesRepository = NotesRepository()
    }
}
But i got an error in `NotesRepository()`: "Interface NotesRepository does not have constructors" Don't really not what to do, so i'm open to all the help 😉 (sorry for my bad english)
j

Josh Eldridge

05/07/2023, 3:39 AM
It sounds like you're trying to construct an instance of the interface instead of the class that implements the interface, what's the class that implements
NotesRepository
?