title: How to create a user profile based on uid and navigate to the profile page?
body: <p>I created a user with firebase authentication, also it has its own database.<a href="https://i.stack.imgur.com/NFIY2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NFIY2.png" alt="Like this" /></a></p>
  <p>The user can send friend requests to other users, the senders uid is saved in the receiver user's request collection. In my app I can list the requests.</p>
  <p><a href="https://i.stack.imgur.com/jaI19.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jaI19.jpg" alt="requests" /></a></p>
  <p>So I have the user’s uid and when I press the eye icon I want to navigate to another page where will be the user’s profile. So I need something like UserProfilePage class. Here’s my code:</p>
  <pre><code>import 'package:flutter/material.dart';
  import 'package:cloud_firestore/cloud_firestore.dart';
  import 'package:flutter_auths/pages/profilepage.dart';
  import 'package:flutter_auths/services/authentications.dart';
  import 'package:flutter_auths/main.dart';
  
  
  class RequestPage extends StatefulWidget {
    final String uid;
  
    RequestPage({Key key, @required this.uid}) : super(key: key);
  
    @override
    _RequestPageState createState() =&gt; _RequestPageState(uid);
  }
  
  class _RequestPageState extends State&lt;RequestPage&gt; {
    final String uid;
    _RequestPageState(this.uid);
  
    var taskcollections = Firestore.instance.collection('users');
    String task;
  
  
    void acceptFriendRequest(String theUid) async {
      await Firestore.instance
          .collection('users')
          .document(uid)
          .collection('friendships')
          .document()
          .setData({
        'FriendUid': theUid,
      }).then((onValue) {
        print('current user: ');
        print(uid);
        print(theUid);
      });
  
      await Firestore.instance
          .collection('users')
          .document(theUid)
          .collection('friendships')
          .document()
          .setData({
        'FriendUid': uid,
      }).then((onValue) {
      });
  
      await Firestore.instance
          .collection('users')
          .document(uid)
          .collection('requests')
          .document(theUid)
          .delete();
    }
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        floatingActionButton: FloatingActionButton(
          onPressed: () {  },
          child: Icon(Icons.add),
        ),
        appBar: AppBar(
          title: Text(
            &quot;Requests&quot;,
            style: TextStyle(
              fontFamily: &quot;tepeno&quot;,
              fontWeight: FontWeight.w600,
            ),
          ),
          actions: &lt;Widget&gt;[
            IconButton(
              icon: Icon(Icons.exit_to_app),
              splashColor: Colors.transparent,
              highlightColor: Colors.transparent,
              onPressed: () =&gt; signOutUser().then((value) {
                Navigator.of(context).pushAndRemoveUntil(
                    MaterialPageRoute(builder: (context) =&gt; HomePage()),
                        (Route&lt;dynamic&gt; route) =&gt; false);
              }),
            ),
          ],
        ),
        body: StreamBuilder&lt;QuerySnapshot&gt;(
          stream: taskcollections
              .document(uid)
              .collection('requests')
              .snapshots(),
          builder: (context, snapshot) {
            if (snapshot.hasData) {
              return ListView.builder(
                itemCount: snapshot.data.documents.length,
                itemBuilder: (context, index) {
                  DocumentSnapshot ds = snapshot.data.documents[index];
                  return Container(
                    decoration: BoxDecoration(
                      color: Colors.blue,
                      borderRadius: BorderRadius.circular(5.0),
                    ),
                    margin: EdgeInsets.all(8.0),
                    child: ListTile(
                      title: Text(
                        ds['FriendUid'] ?? '',
                        style: TextStyle(
                          fontFamily: &quot;tepeno&quot;,
                          fontSize: 18.0,
                          color: Colors.white,
                        ),
                      ),
                      trailing: Wrap(
                        spacing: 7, // space between two icons
                        children: &lt;Widget&gt;[
                          IconButton(
                            icon: Icon(
                              Icons.check,
                              size: 27.0,
                              color: Colors.brown[900],
                            ),
                            onPressed: () {
                              acceptFriendRequest(ds['FriendUid']);
                            },
                          ),
                          IconButton(
                            icon: Icon(
                              Icons.do_not_disturb,
                              size: 27.0,
                              color: Colors.brown[900],
                            ),
                            onPressed: () {
                              //   _onDeleteItemPressed(index);
                            },
                          ),
                          IconButton(
                            icon: Icon(
                              Icons.remove_red_eye,
                              size: 27.0,
                              color: Colors.brown[900],
                            ),
                            onPressed: () {
  
  
                            },
                          ),
                        ],
                      ),
  
                    ),
                  );
                },
              );
            } else if (snapshot.hasError) {
              return CircularProgressIndicator();
            } else {
              return CircularProgressIndicator();
            }
          },
        ),
      );
    }
  }
  
  </code></pre>
  <p>I’m a beginner in Flutter. Thank you for your help.</p>