android / android/architecture-samples

[dev-hilt] Dispatchers.IO is singletone (Or in dependency graph)?

Open
#763 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
45.8k
Forks
11.9k
PR merge metrics
No merged PRs in 30d

Description

I was checking the template implementation of Hilt(DI), but I am not sure why do we need to define `Dispatchers.IO` in dependency graph (if require, then why singleton?) as it is already a JVMStatic by default in `kotlinx.coroutines` packages.

Branch: [dev-hilt](https://github.com/android/architecture-samples/tree/dev-hilt)
Implementation Reference: [click here](https://github.com/android/architecture-samples/blob/dev-hilt/app/src/main/java/com/example/android/architecture/blueprints/todoapp/di/AppModule.kt#L87)

Contributor guide

Open the contributing guide

Research direction

Start with app/src/main/java/com/example/android/architecture/blueprints/todoapp/di/AppModule.kt at the referenced line on the dev-hilt branch, then inspect how Dispatchers.IO is provided and consumed. Compare that binding with kotlinx.coroutines' Dispatchers.IO behavior; done means establishing whether the dependency-graph singleton is necessary and identifying the appropriate change or explanation.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
mobile
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.