I am creating a new user with authentication, and setting the User Key in the database as the User UID.

```
private fun writeNewUser(name: String, email: String?) {
        val user = User(name, email)
        mDatabase.child("Users").child(mAuth.currentUser!!.uid).setValue(user)
}

```

This works fine and produces the following result:
[![Authentication + Write Database Result](https://i.stack.imgur.com/rsME5.png)](https://i.stack.imgur.com/rsME5.png)

I'm now trying to login and read that user's information.

I'm trying to set the UID as the database reference (after having successfully logged in).  
\*My Login process is working.  

I'm getting an error on MainActivity where I'm trying to display the data:

***Error***:
None of the following functions can be called with the arguments supplied:

***Line***:
key?.let { getValue(mAuth.uid) }  

Here's my MainActivity code where I'm trying to read and display the data.

```
class MainActivity : AppCompatActivity() {

    private lateinit var mUser: User
    private lateinit var mAuth : FirebaseAuth
    private lateinit var mDatabase: DatabaseReference

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        mAuth = FirebaseAuth.getInstance()
        mDatabase = FirebaseDatabase.getInstance().reference

        fun currentUserReference(): DatabaseReference =
            mDatabase.child("users").child(mAuth.currentUser!!.uid)

        currentUserReference().addListenerForSingleValueEvent(
            ValueListenerAdapter{
                mUser = it.asUser()!!
                tv_main_name.setText(mUser.name)
                tv_main_email.setText(mUser.email)
            }
        )

    }

    fun DataSnapshot.asUser(): User? =
        //error on this line ↓
        key?.let { getValue(mAuth.uid) }

}

```

**Edit 1**

Existing ValueListenerAdapter.kt

```

class ValueListenerAdapter(val handler: (DataSnapshot) -> Unit): ValueEventListener {

    private val TAG = "ValueListenerAdapter"

    override fun onDataChange(data: DataSnapshot) {
        handler(data)
    }

    override fun onCancelled(error: DatabaseError) {
        Log.e("onCancelled", TAG, error.toException())
    }
}

```

**Edit 2**

```
class MainActivity : AppCompatActivity() {

    private lateinit var mUser: User
    private lateinit var mAuth : FirebaseAuth
    private lateinit var mDatabase: DatabaseReference

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        mAuth = FirebaseAuth.getInstance()
        mDatabase = FirebaseDatabase.getInstance().reference

        mDatabase.child("Users").child(mAuth.currentUser!!.uid)
             .addListenerForSingleValueEvent(object : ValueEventListener {

                    override fun onCancelled(p0: DatabaseError) {
                        TODO("Not yet implemented")
                    }

                    override fun onDataChange(p0: DataSnapshot) {

                        //Declare mUser as chosen DB User

                        tv_main_name.setText(mUser.name)
                        tv_main_email.setText(mUser.email)
                    }
                })
    }
}

```

**Edit 3**

```
override fun onDataChange(p0: DataSnapshot) {
     if (p0.hasChildren()) {
          //Declare mUser as chosen DB User
          tv_main_name.setText(mUser.name)
          tv_main_email.setText(mUser.email)
          }                        
     }

```