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 document = querySnapshot.docs[0].data();
- // Access the specific field in the document
- var specificElement = document['username'];
- // Now you can work with the specific element
- print('Found specific element: $specificElement');
- } else {
- print('No matching documents found.');
- }
Add Comment
Please, Sign In to add comment