I am trying to get a document from the database where the users can put in an email and it will pull the document and save it so I can use the document in an editing module. Here is my readUsers method
Future ReadUserinDatabase(String email) async {
Stream<List<DatabaseUser>> User = FirebaseFirestore.instance
.collection('Users')
.where('Email' == email)
.snapshots()
.map((snapshot) => snapshot.docs
.map((doc) => DatabaseUser.fromJson(doc.data()))
.toList());
print(User.map);
}
I will be grabbing the document ID from the returned document so I can put it in for doc to edit
Future EditUserinDatabase(
String oldemail, String newemail, String oldrole, String newrole) async {
final docUser = FirebaseFirestore.instance.collection('TEST').doc('Doc ID goes Here');
await docUser.update({'Email': newemail, 'Role': newrole});
}
The error that is occurring is when I print User.map it is not printing the information in the document it is printing '$user' and is not saving in a form I can use it. How do I save the document