Does anyone know if `hiltViewModel()` from android...
# compose-android
s
Does anyone know if
hiltViewModel()
from androidx.hilt:hilt-navigation-compose is supposed to provide the same
SavedStateHandle
to the
ViewModel
that the
NavBackStackEntry
gets? That would make sense to me, at least, but it's not what I'm seeing:
Copy code
composable("route") { bse ->
  bse.savedStateHandle.set("some-key", "some-value")

  val viewModel: ScreenViewModel = hiltViewModel()
}
Copy code
@HiltViewModel
internal class ScreenViewModel @Inject constructor(
  savedStateHandle: SavedStateHandle,
) : ViewModel() {
  init {
    println(savedStateHandle["some-key"]) // prints null
  }
}
i
s
Oh, wow, I don't know how I missed that in my searching! I'll give that approach a go tomorrow. Thanks!