Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var collectionReference = FirebaseFirestore.instance.collection('users');
- var query = collectionReference.where('id', isEqualTo: firebaseAuth.currentUser!.uid );
- var querySnapshot = await query.get();
- if (querySnapshot.docs.isNotEmpty) {
- // Access the first document (you may need to loop through if you expect multiple matches)
- var doc = querySnapshot.docs[0].data();
- String bio = doc['bio'];
- String country = doc['country'];
- String email = doc['email'];
- String gender = doc['gender'];
- String id = doc['id'];
- bool isOnline = doc['isOnline'];
- Timestamp lastSeen = doc['lastSeen'];
- String photoUrl = doc['photoUrl'];
- String userName = doc['username'];
- Timestamp time = doc['time'];
- User curUser = new User.Complete(userName,email,country,bio,gender,photoUrl,id,lastSeen,isOnline,time);
- print(curUser.email);
- } else {
- print('No matching documents found.');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement