https://kotlinlang.org logo
#compose
Title
# compose
l

Luca Nicoletti

02/26/2024, 5:22 PM
Anyone has any idea what I could be doing wrong here?
c

Chrimaeon

02/26/2024, 5:57 PM
As they say in the comments - would be easier to track down if you post the view model code 😅
Wild guess, you forgot the
@HiltViewModel
annotation.
l

Luca Nicoletti

02/26/2024, 8:12 PM
No, I didn’t, the ViewModel is empty, just has a dependency in the constructor
Copy code
@HiltViewModel
class ViewModelC @Inject constructor(
    private val getAllCData: GetAllCData,
) : ViewModel() {

    val viewState = MutableStateFlow(CViewState())
}
Note that moving the dependency to another of the viewModels (used from the first 2 screens) won’t result in the same problem Removing the dependency will solve the problem, only if removed from that specific ViewModel. Using another dependency (already used from other ViewModels) would still cause the problem
s

Stylianos Gakis

02/26/2024, 10:23 PM
Sounds weird, if you can make a minimal repro that would be nice. If not, idk try to delete all the generated code from hilt and build from scratch, it might be some hilt magic going wrong.