title: How To get data from firestore of current user in flutter?
body: <p>I want to get data of authenticated user  from firestore and put them in variables in flutter, I do not need to display them on the screen I  just want to store them in variables  : I created file data.dart It has only variables . this is the file contains the variables(data.dart) (I dont have statefull widget or stateless widget) :
  <a href="https://i.stack.imgur.com/Sr91R.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Sr91R.png" alt="Data.dart" /></a></p>
  <p>and this is the file where I called The variables(firbaseapi.dart):</p>
  <p><a href="https://i.stack.imgur.com/BjheP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BjheP.png" alt="firebaseapi.dart" /></a></p>
  <pre><code>String myId = &quot;AfhUxYFIaHTvSOyOPlh14essssq9pJpW2&quot;; // I want to get user id here
  String myUsername = 'Sabri'; // I want to get username here
  String myUrlAvatar = 'http//kdkskdskd'; // I want to get  avatar URL here 
  </code></pre>
  <p>I tried this but I got an error :
  A value of type 'Future' can't be assigned to a variable of type 'DocumentSnapshot'.
  Try changing the type of the variable, or casting the right-hand type to 'DocumentSnapshot'</p>
  <pre><code>User user = FirebaseAuth.instance.currentUser;
  DocumentSnapshot snap = 
      FirebaseFirestore.instance.collection('Users').doc(user.uid).get();//error appear here     
       String myId = snap['uid'];
       String myUsername = snap['name'];
       String myUrlAvatar = snap['avatarurl'];
  </code></pre>