Hello, I've a difficult question. I use Hilt. I ge...
# dagger
h
Hello, I've a difficult question. I use Hilt. I get  this error   'java.lang.IllegalArgumentException: SavedStateProvider with the given key is already registered'. What is the reason?
Copy code
Fragment
private var instance: LoginFragment? = null
 private val viewModel by viewModels<AuthViewModel>()
 override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        binding = FragmentLoginBinding.bind(view)
        instance =this
}

fun login(): String {
    viewModel.login(clientId, partner.toString(), password)
    val clientId = binding.editTextTextEmailAddress.text.toString().trim()

    val encrypted = encrypt(clientId, publicKey)
  
    return encrypted
}
RemoteDataSource
Copy code
private fun getRetrofitClient(): OkHttpClient {

    val str= LoginFragment().getInstance()?.login()
....
g
s
Copy code
private var instance: LoginFragment? = null
what is this??