sample list:
_events = [{ "name" : "A", "date" : "15 jun" },
{ "name" : "B", "date" : "15 jun" },
{ "name" : "C", "date" : "17 jun" },
{ "name" : "D", "date" : "17 jun" },]
kEvents = LinkedHashMap<DateTime, List<dynamic>>(equals: isSameDay, hashCode: getHashCode)
..addAll(_events);
int getHashCode(DateTime key) {
return key.day * 1000000 + key.month * 10000 + key.year;
}
i am expecting the kEvents will be displaying all data for a particular day, for example if kEvents['27 jun'] it should become:
[{ "name" : "C", "date" : "17 jun" },
{ "name" : "D", "date" : "17 jun" },]
however my result was:
[{ "name" : "D", "date" : "17 jun" }]
the last item replaced previous item instead of append to the list.... why?