title: Table Calendar stacking events for specific date - Flutter
body: <p>I am using Flutter, firestore with table calendar.</p>
  <p>Here is my code, currently working but with a small glitch</p>
  <pre><code>              //Initialize Events
                List&lt;Event&gt; eventList = List&lt;Event&gt;();
                //Get events and add them to the list.
                eventsSnapshot.data.documents.forEach((doc) {
                  Timestamp _eventDateStart = doc.data['eventDateStart'];
                  Timestamp _eventDateFinish = doc.data['eventDateFinish'];
                  Event _thisEvent = Event('test',
                        doc.data['eventName'],
                        doc.data['eventPrice'],
                        doc.data['eventDescription'],
                        _eventDateStart.toDate(),
                        _eventDateFinish.toDate());
                  print('Event added : ${_thisEvent.eventName.toString()}');
                  eventList.add(_thisEvent);
                 });
                 
                _events = convertToMap(eventList);
  </code></pre>
  <p><strong>here is my converToMap</strong></p>
  <pre><code>class Event {
    final String id;
    final String eventName;
    final double eventPrice;
    final String eventDescription;
    final DateTime eventDateStart;
    final DateTime eventDateFinish;
  
    Event(this.id, this.eventName, this.eventPrice,this.eventDescription, this.eventDateStart, this.eventDateFinish);
  }
  
  //method to change calendar item to Map&lt;DateTime,List&gt;
  Map&lt;DateTime, List&lt;Event&gt;&gt; convertToMap(List&lt;Event&gt; item) {
    Map&lt;DateTime, List&lt;Event&gt;&gt; result;
  
    for (int i = 0; i &lt; item.length; i++) {
      Event data = item[i];
      //get the date and convert it to a DateTime variable
      DateTime currentDate = data.eventDateStart;
      List&lt;Event&gt; events = [];
      //add the event name to the the eventNames list for the current date.
      //search for another event with the same date and populate the eventNames List.
      for (int j = 0; j &lt; item.length; j++) {
        //create temp calendarItemData object.
        Event temp = item[j];
        //establish that the temp date is equal to the current date
        if (data.eventDateStart == temp.eventDateStart) {
          //add the event name to the event List.
          events.add(temp);
        } //else continue
      }
  
      //add the date and the event to the map if the date is not contained in the map
      if (result == null) {
        result = {currentDate: events};
      } else {
  
        result[currentDate] = events;
      }
    }
    print(result);
    return result;
  }
  </code></pre>
  <p>The result of the print is pretty this.</p>
  <p>I/flutter ( 1655): Event added : deuxio
  I/flutter ( 1655): Event added : PremierVraiTest
  I/flutter ( 1655): Event added : Test
  I/flutter ( 1655): {2020-09-17 13:00:00.000: [Instance of 'Event'], 2020-09-17 12:00:00.000: [Instance of 'Event'], 2020-09-18 12:00:00.000: [Instance of 'Event']}</p>
  <p><strong>The problem now:</strong>
  When I check my calendar I see 1 event of the 17 and 1 event for the 18.
  The 17 event is the one with 13:00. I don't see the second event.</p>