Created
September 17, 2023 16:36
-
-
Save khahani/ca3dafd6b152eba4b40f2d931fccbc11 to your computer and use it in GitHub Desktop.
UpdateCoroutineScope.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @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