How to provide an object using hilt in background thread with coroutine
I want provide a realm object in background thread like this:
@Module
@InstallIn(SingletonComponent::class)
object DatabaseModule {
@Provides
@Singleton
fun provideDatabaseScope(): CoroutineScope = GlobalScope +
Dispatchers.IO
@Provides
@Singleton
fun provideDatabaseQueue(): ExecutorCoroutineDispatcher =
Executors.newSingleThreadExecutor().asCoroutineDispatcher()
@Provides
@Singleton
fun provideGetRealmConfig(accountService: AccountService):...