Using ViewModel in jetpack compose, what is the best approach to sending parameters to the viewmodel class using viewmodel factory
I want to save data inside the phone without accessing internal storage in device. Through this tutorial https://medium.com/@rowaido.game/persistent-data-storage-using-datastore-preferences-in-jetpack-compose-90c481bfed12 , I used the step by step guide and build and it works great. My issue is the tutorial uses ViewModelProvider.Factory, the tutorial approach doesn’t allow me to send parameters to the viewModel class.
When Ever I want to call MyApplication().UserRepository the error says it has to be initialized