Assisted Injection With Dagger and Hilt |

Learn what assisted injection is used for, how it works, and how you can add it to your app with Dagger’s new built-in support for the feature.

This is a companion discussion topic for the original entry at

Why not just using @HiltViewModel, @ViewModelScoped?

Hi @mmathieum
Thank you for your message.

@HiltViewModel allows you to make a ViewModel available for injection in the dependency graph.
@ViewModelScoped allows you to give that instance a scope typical of a ViewModel which can “resist” a configuration change like a rotation.

Unfortunately, when I wrote the tutorial, those annotations didn’t work with assisted injection and so with @AssistedInject.