Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. @Module
  2. class ApplicationModule {
  3. @Singleton
  4. @Provides
  5. fun provideIoDispatcher(): CoroutineDispatcher = Dispatchers.IO
  6. @Singleton
  7. @Provides
  8. fun provideMainDispatcher(): MainCoroutineDispatcher = Dispatchers.Main
  9.  
  10. @Singleton
  11. @Provides
  12. fun provideDataBase(context: Context): ToDoRoomDatabase {
  13. return Room.databaseBuilder(
  14. context.applicationContext,
  15. ToDoRoomDatabase::class.java,
  16. "Task.db"
  17. ).build()
  18. }
  19. @Provides
  20. fun provideTasksDao(db: ToDoRoomDatabase) = db.tasksDao()
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement