I have an events class thats like this
MyEvents(id: 5a9c120ab3473,
title: "Event 1",
description: "",
image: "",
isDone false,
classDate: 2019-08-23 00:00:00.000)
I'm getting a list from a database but i cant figure out how to turn it into this format for a calendar package (there could be multiple events on each day)
Map<DateTime, List<Map<String, Object>>> _events2 = {
DateTime(2019, 8, 24): [
{'name': 'Event A', 'isDone': true},
],
DateTime(2019, 8, 24): [
{'name': 'Event A', 'isDone': true},
],
DateTime(2019, 8, 23): [
{'name': 'Event A', 'isDone': true},
],
};
I've tried this, not sure if I'm on the right track or totally lost
events.map((c) {
print(c.title);
item = {
c.classDate: [
{'name': c.title, 'isDone': true},
]
};
mainList.add(item);
}).toList();