Further reading
Knowing how to work with the basics of Hilt is usually enough for most projects. However, sometimes you might need to use more advanced features of Hilt or Dagger. To learn more about Dagger and how the framework automatically creates the dependencies for you by building a dependency graph, check this article: https://medium.com/android-news/dagger-2-part-i-basic-principles-graph-dependencies-scopes-3dfd032ccd82.
On the same note, apart from the @Singleton
scope that was the most used scope throughout our app, Dagger Hilt exposes a broader variety of predefined components and scopes that allow you to scope different classes to various lifecycles. Check out more about components and their scopes in the official documentation: https://dagger.dev/hilt/components.html.
Leaving components and their scopes aside, in some projects, you might need to allow injection of dependencies in other Android classes than Activity
. To see which Android classes can be annotated with...