Skip to content

Instantly share code, notes, and snippets.

@khahani
Created September 17, 2023 16:36
Show Gist options
  • Select an option

  • Save khahani/ca3dafd6b152eba4b40f2d931fccbc11 to your computer and use it in GitHub Desktop.

Select an option

Save khahani/ca3dafd6b152eba4b40f2d931fccbc11 to your computer and use it in GitHub Desktop.
UpdateCoroutineScope.kt
@Module
@InstallIn(SingletonComponent::class)
object CoroutineScopesModule {
@Provides
@Singleton
@ApplicationScope
fun providesApplicationScopeWithIODiapatcher(
@Dispatcher(IO) ioDispatcher: CoroutineDispatcher,
@ApplicationScope scope: CoroutineScope,
): CoroutineScope = CoroutineScope(scope.coroutineContext + ioDispatcher) // <- What I meant by updating dispatcher
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment