Dependencies

implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.6.0")ℹ️ You can use
ViewModelwithout dependencies, but get limited lifetime (the ViewModel will be destroyed every time the composable where it’s declared is recomposed or destroyed). So you have to place the viewModel atMainActivitywhere it won’t be destroyed or recomposed during runtime.
⚠️ Installing the dependencies will extend the lifetime of the viewModel