I am pursuing a course on Udemy on flutter development, I am a beginner trying to master flutter, In the mid-way of the course, my instructor has the below code:
void getMessages() async {
final messages = await _fireStore.collection('messages').get();
for (var message in messages.docs) {
print(message.data);
}
}
And I had the same code as above when executed, she was able to read the data of the messages in firestore, while I was unable to print the same message, even though the code was same, after tweaking the code, I changed my code as below, by just adding the '()' on the message.data();, Now I am also able to see the messages.
The question here is how did she get the data printed without using () on messages.data, I am a beginner, I would like to understand the logic, please.
void getMessages() async {
final messages = await _fireStore.collection('messages').get();
for (var message in messages.docs) {
print(message.data());
}
}