Hilt là thư viện DI được xây trên Dagger, thiết kế riêng cho Android.
- Nó loại bỏ boilerplate bằng cách cung cấp module có sẵn cho Android component.
- Đánh dấu Application với
@HiltAndroidApp, Activity/Fragment với@AndroidEntryPoint, và inject bằng@Inject. - Hilt tự động quản lý scope (như
@Singleton) và tích hợp liền mạch với ViewModel và composable.
Hilt is a dependency injection library built on Dagger, designed specifically for Android.
- It eliminates boilerplate by providing predefined modules for Android components.
- Mark your Application with
@HiltAndroidApp, Activities/Fragments with@AndroidEntryPoint, and inject with@Inject. - Hilt automatically manages scopes (like
@Singleton) and integrates seamlessly with ViewModels and composables.