Use DI ( Dagger 2/Hilt ) at runtime without broke MVVM pattern?
suppose i need to let user login at runtime using MVVM and DI patterns
and i have Repository that have function to make login
class RepositoryLogin @Inject constructor() {
fun login(login: Login){
...
}
}
Now we need ViewModel that pass this Login object to our Repository at runtime, here is some of my solution:
Use @AssistedInject to construct ViewModel at runtime with parameters
and call "login" function that creates inside in viewModel an istance of Login class. But in...