Dependency Injection with Hilt: Fundamentals

In this dependency injection course, learn how to apply an awesome new library called Hilt, to build dependency graphs, and inject dependencies into Android components in an automatic and lifecycle-aware way, without having to write a ton of boilerplate code, you had to write with Dagger. By Filip Babić.

4 (14) · 3 Reviews

Save for later
Comments
Share

Who is this for?

Advanced Android developers, who have used the Dagger dependency injection framework and tool, for their projects, but are looking to improve their DI code, by removing lots of boilerplate code from Dagger, and using Hilt to automatize the process behind injecting dependencies, and building graph components.

This course is also for developers who have used Koin or Kodein, and are looking for different solutions to inject dependencies in their code.

It expects of you to have a good understanding of Android Studio, Android, Kotlin, code structure and SOLID principles. Familiarity with dependency injection libraries and the topic is not required, but is definitely helpful.

Covered concepts

  • Theory behind code structure and layers in apps
  • Using SOLID principles to write code
  • Dependency Inversion principle from SOLID
  • Dagger DI framework basics
  • Modules and Providers
  • Hilt fundamentals
  • Connecting Hilt dependencies in components
  • Injecting dependencies using Hilt
  • Applying Scopes to reuse dependencies
01
Toggle description

Revise why it's important to structure your code in a layered way, and why you need to apply the dependency inversion principle. Learn about Koin, Dagger and Hilt.

Toggle description

Learn how to set up your project to use Hilt, and start providing the basic Hilt components, such as the @HiltApplication.

Toggle description

Use @Provides and @Binds annotations and functions to provide dependencies in modules and build factories. Add the @Singleton scope, to bind dependencies to the app-level lifecycle.

Toggle description

Use the @AndroidEntryPoint annotation to provide entries for Hilt to inject dependencies to, and inject code using the @Inject annotation.