Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@Module class AppModule(private val context: Context) {
@Provides fun providesAppContext() = context
@Provides fun providesAppDatabase(context: Context): AppDatabase =
Room.databaseBuilder(context, AppDatabase::class.java, "my-todo-db").allowMainThreadQueries().build()
@Provides fun providesToDoDao(database: AppDatabase) = database.taskDao()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment