Functional difference between @Binds and @Provides in Hilt

Tests if you understand Hilt code generation tradeoffs. @Binds wires an existing injectable implementation to an interface with less overhead; @Provides constructs instances manually.
Tests your grasp of Hilt code generation and when Dagger can skip factory creation. A strong answer states that @Binds is an abstract method mapping an injectable implementation to its interface with zero factory overhead, while @Provides is a concrete factory for manual construction or third-party types. You must use @Provides when the implementation lacks an @Inject constructor, requires configuration, or comes from an external library. Red flag: saying @Binds and @Provides are interchangeable or that @Binds can run arbitrary setup logic.
Read the original → developer.android.com
- #android
- #hilt
- #dependency-injection
- #dagger
- #kotlin
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.