I've been working on a Database with Firestore. The DB itself is working, but when I try to get the values from a harshMap I get a null value, eventhough I can see that the DB shows (on the page) the parameter I'm trying to get.
So my question is the next one: Is there a proper way to get a value from a harshMap in another activity?
There are some comments on the code, please take a look at them.
setup() on Activity "A"
private fun setup(){
           crearCuentaButton.setOnClickListener{
            if (inputEmail.text.isNotEmpty() && inputContraseña.text.isNotEmpty()){
                val db = FirebaseFirestore.getInstance()
                val userData = hashMapOf(
                    "username" to inputUsername.text.toString(),
                    "email" to inputEmail.text.toString()
                )
                db.collection("users")
                    .add(userData)
                FirebaseAuth.getInstance().createUserWithEmailAndPassword(inputEmail.text.toString(), inputContraseña.text.toString()) .addOnCompleteListener {
                    if(it.isSuccessful){
                        showAuth(it.result?.user?.email ?: "", ProviderType.Email)
                    }
                    else{
                        showError()
                    }
                }
                Intent(this, HomeActivity::class.java).also {
                    val userName = userData["username"]
                    println(userName)
                    it.putExtra("dataBaseUsernameValue", userName) //<------ this is the value I'm trying to get, the println shows the variable perfectly, but when passing it through, it doesn't.
                    
                }
            }
        }
}
onCreate on Activity "B"
class HomeActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_home)
    homeBanner()
    val username = intent.getStringExtra("dataBaseUsernameValue")
    println(username) //<----------------- here I get the "null"
}
