3. Dagger – DI framework by Square
Dagger 2 – DI framework by Google
dagger.android – extension of Dagger 2 by Google
Hilt – abstraction over Dagger 2 by Google
@VasiliyZukanov 3
History of Dagger
4. Migrate the tutorial app from Dagger 2 to Hilt
Discuss Hilt’s pros and cons
Should you adopt or refactor to Hilt right now?
Future predictions (also known as “conspiracies”)
My stuff (if time permits)
@VasiliyZukanov 4
Our plan for today
9. Hilt Pros and Cons
@VasiliyZukanov 9
Cons:
• Hilt requires additional annotation
processor
• Yet another annotation processor for
ViewModel handling
• Complexity leaks in non-trivial cases (e.g.
FragmentFactory)
• Gradle plugin (optional)
• Immaturity
Pros:
• Better conventions than dagger.android
• Simpler handling of ViewModels and
SavedStateHandle
• Standardization
• Simpler integration, UI and E2E testing *
• Better documentation **
10. @VasiliyZukanov 10
Do you need to migrate to Hilt?
To me, Hilt doesn’t provide any benefits at this point…
…but I never adopted dagger.android…
11. @VasiliyZukanov 11
If Hilt doesn’t bring new capabilities, why Google pushes it
so hard?
*speculation (conspiracy) warning*
IMO, 50%+ probability that Hilt will support KMP projects
12. @VasiliyZukanov 12
If you’re interested in professional-grade Android
development content…
www.TechYourChance.com