This course is available as part of the raywenderlich.com Professional subscription. To learn more click here

Dependency Injection with Hilt: Fundamentals

Pro

Jun 22 2020 · Video Course (16 mins) · Advanced

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.

5/5 1 Rating

Version

  • Kotlin 1.3, Android 10, Android Studio 4

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.

1

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

2

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.

3

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

4

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

Contributors

Comments