title: get user data from uid in firebase database flutter
body: <p>Can you help me? I've only been learning Flutter for a few months and I want to get user data from Firebase and display the user profile. But it doesn't work, this is my code:</p>
  <pre><code>DatabaseReference _ref;
  
    var email, nama, noTelp;
  
    @override
    void initState() {
      // TODO: implement initState
      super.initState();
  
  
  
      final User usernya = _auth.currentUser;
      final String uid = usernya.uid;
  
      _ref = FirebaseDatabase.instance.reference().child('user').child(uid);
  
      email = _ref.child('email');
      nama = _ref.child('nama');
      noTelp = _ref.child('noTelp');
    }
  </code></pre>
  <p>And this code for user profiles:</p>
  <pre><code>Column(
                              crossAxisAlignment: CrossAxisAlignment.start,
                              children: [
                                _ref == null
                                    ? Text(
                                        'Nama Pengguna',
                                        style: TextStyle(
                                            fontSize: 18,
                                            fontWeight: FontWeight.bold,
                                            color: Colors.white),
                                      )
                                    : Text(
                                        nama.toString(),
                                        style: TextStyle(
                                            fontSize: 18,
                                            fontWeight: FontWeight.bold,
                                            color: Colors.white),
                                      ),
                                Text(
                                  email.toString(),
                                  style: (TextStyle(color: Colors.white)),
                                ),
                                Text(noTelp.toString(),
                                    style: (TextStyle(color: Colors.white)))
                              ],
                            )
  </code></pre>
  <p>And I get output like this <strong>instance of 'Database Reference'</strong></p>
  <p>This is my user data in firebase:</p>
  <p><a href="https://i.stack.imgur.com/2IqdD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2IqdD.png" alt="enter image description here" /></a></p>
  <p>And I got output like this:</p>
  <p><a href="https://i.stack.imgur.com/KBKYk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KBKYk.png" alt="enter image description here" /></a></p>