Summary
In this chapter, we improved the architecture of the Restaurants App by incorporating DI.
We discussed what DI is and covered its basic concepts: dependency with its implicit or explicit types, injection, dependency containers, and manual injection.
We then examined the main benefits that DI brings to our projects: testable classes and less boilerplate code.
Finally, we covered how DI frameworks can help us with the injection of dependencies, and explored the Jetpack Hilt library as a viable solution for DI on Android. Afterward, we practiced what we learned as we incorporated DI with Hilt in our Restaurants app.
Since we incorporated DI, it's a bit clearer that our classes can be easily tested, so it's time we start writing some tests in the next chapter!