- [Instructor] In previous videos we worked…a complex example using Dagger…in a real world application, and it didn't quite work,…but I promise that we could fix it.…The reason it didn't work is that…we couldn't yet tell Dagger to create…a key of type class out ViewModel.…We now know how to create more complex key types…using the @MapKey annotation.…In the last video, we used @MapKey…to create a new key annotation,…that created a mapkey from an enum.…
In this video, we'll see how to create…a map with a more complex key.…Again note, that the complete documentation…for the syntax for annotation classes…is available at kotlinlang.org.…I'm not going to write all this code out,…it's very similar to code we've seen before.…What I do want to point out, is that the @MapKey…annotation, when applied to an annotation class…with multiple parameters, must have…it's unwrap value parameter set false.…
The MapKey annotation parameter unwrap value…has to be set false.…This creates a new annotation, ComplexKey,…which we can use to create mapkeys in our module.…
Author
Released
2/1/2019- Dagger basics
- Method and field injection
- Lazy and provider injection
- Dagger annotations: @Module, @Binds, @Provides, and @Named
- Multibinding
- Components and subcomponents
- Singletons and custom scope
Skill Level Advanced
Duration
Views
Related Courses
-
Android App Development: Data Persistence Libraries
with Annyce Davis4h 52m Intermediate -
Intermediate Kotlin for Android Developers
with Annyce Davis2h 8m Intermediate
-
Introduction
-
What you should know1m 37s
-
Using the exercise files1m 15s
-
1. Basics
-
What is Dagger?3m 53s
-
Why use Dagger?3m 44s
-
Setting up a Dagger project2m 46s
-
-
2. Essential Dagger
-
Method and field injection7m 13s
-
Lazy and provider injection4m 20s
-
3. Modules
-
Multibinding: Sets4m 42s
-
4. Components
-
@Components review2m 47s
-
@Component dependencies6m 53s
-
Introducing @Subcomponents4m 21s
-
@Subcomponents review3m 22s
-
-
5. Scope
-
Rethinking the graph1m 20s
-
@Singletons and @Reuseable3m 31s
-
Custom @Scope5m 13s
-
-
Conclusion
-
Next steps2m
-
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.
CancelTake notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.
Share this video
Embed this video
Video: Real-world example: Architecture components solved