How to pass id and application to a viewModel/viewModelFactory in Jetpack Compose?
To answer your question: you retrieve the Application from the LocalContext object: val context = LocalContext.current val application = context.applicationContext as Application However, when using Navigation Compose, you don’t need to manually pass any arguments to your ViewModel. Instead, you can utilize the built in support for SavedState in ViewModels and add a SavedStateHandle parameter … Read more