Hi all, I've been doing some research all night an...
# koin
j
Hi all, I've been doing some research all night and can't seem to find an answer, but does anyone know if the savedStateHandle data from a back stack entry is supposed to populate the
koinViewModel
's SavedStateHandle that's scoped to it? I'm trying to figure out how to populate this long into the viewmodel. I've tried passing it to
parameters
and that just results in a NoBeanDefFoundException when trying to inject it as well.
Copy code
val selectedId = backStackEntry.savedStateHandle.get<Long>("selectedId")
val createBuildViewModel: CreateBuildViewModel = koinViewModel()
Well I can manually inject into the savedStateHandle and it does what I want it to, but still wondering if there is a more proper way?
createBuildViewModel.savedStateHandle["selectedId"] = selectedId
p
from usage I guess the last message is fine to use it like that. ViewModel and Fragments have separate lifecycle so should be ok
a
I believe so, should work 🤔