I am building an event management app. When the user buys a ticket, the ticket details are being saved in the DB like this.
Users -> (Current User ID) -> (map)bookedEvents -> eventId -> [event details]
I managed to display data of one specific event when I give one of the Event IDs as a static String like this.
StreamBuilder(
stream: FirebaseFirestore.instance
.collection('users')
.doc(_uid)
.snapshots(),
builder: (context, snapshot) {
if (!snapshot.hasData) {
return Text("Loading");
}
var userDocument = snapshot.data;
return Text(
userDocument["bookedEvents"]["KFXvCj63y7GTjQcMKfVy"]
["eventName"],
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
);
}),
But I want to display all the Event Names in a list. Could I know how? Thank you so much.
