title: Null check operator error when all variables have values?
body: <p>I have this Table_Calendar that I am trying to add events to. For some reason, a null check error is thrown (all variables have values) and no data is added to my Map.</p>
  <p>I added the line // ### THIS IS WHERE IT FAILS to show where the error pops (inside the _loadMeetupsForMonth function).</p>
  <pre><code>import 'package:cloud_firestore/cloud_firestore.dart';
  import 'package:firebase_auth/firebase_auth.dart';
  import 'package:flutter/material.dart';
  import 'package:bark/helpers.dart' as helpers;
  import 'package:loading_overlay/loading_overlay.dart';
  import 'package:table_calendar/table_calendar.dart';
  import 'package:line_icons/line_icons.dart';
  import 'package:bark/addMeetup.dart';
  
  class Meetups extends StatefulWidget {
    Meetups({Key? key}) : super(key: key);
  
    @override
    _MeetupsState createState() =&gt; _MeetupsState();
  }
  
  class _MeetupsState extends State&lt;Meetups&gt; {
    FirebaseFirestore _firestore = FirebaseFirestore.instance;
  
    Map&lt;DateTime, List&lt;CalendarEvent&gt;&gt; eventsForMonth =
        new Map&lt;DateTime, List&lt;CalendarEvent&gt;&gt;();
    bool _isLoading = false;
    List&lt;Widget&gt; _meetups = [];
  
  // ### ADD NEW MEETUP
    _addMeetup() async {
      var _user = FirebaseAuth.instance.currentUser;
      if (_user != null) {
        var doRefresh = await Navigator.of(context)
            .push(new MaterialPageRoute(builder: (context) =&gt; AddMeetup()));
        if (doRefresh == true || doRefresh == null) {
          // Refresh calendar
        }
      } else {
        // Not logged in. Show login popup.
        helpers.showLoginCreateForm(context);
      }
    }
  
    _loadMeetupsForMonth(DateTime _date) async {
      DateTime _start = DateTime(_date.year, _date.month, 1);
      DateTime _end = DateTime(_date.month &lt; 12 ? _date.year : _date.year + 1,
          _date.month &lt; 12 ? _date.month + 1 : 1, 0);
  
      print(_start);
      print(_end);
      print(&quot;Loading data START&quot;);
  
      // Get all for month
      QuerySnapshot querySnapshot = await _firestore
          .collection('Meetups')
          .where(&quot;is_deleted&quot;, isEqualTo: false)
          .where(&quot;meetup_time&quot;, isGreaterThanOrEqualTo: _start)
          .where(&quot;meetup_time&quot;, isLessThanOrEqualTo: _end)
          .orderBy(&quot;meetup_time&quot;, descending: true)
          .get();
  
      if (querySnapshot.docs.isEmpty) {
        print(&quot;No meetups for the month&quot;);
      } else {
        for (final doc in querySnapshot.docs) {
          Timestamp _meetupTime = doc['meetup_time'] ?? DateTime.now();
  
          CalendarEvent _event = new CalendarEvent(
              title: doc[&quot;meetup_title&quot;], postedBy: doc[&quot;poster_name&quot;]);
  
          // ### THIS IS WHERE IT FAILS
          eventsForMonth[_meetupTime.toDate()]!.add(_event);
        }
      }
  
      print(
          &quot;Loading data END: Event count = &quot; + eventsForMonth.length.toString());
    }
  
    List&lt;CalendarEvent&gt; _getEventsForDay(DateTime day) {
      print(&quot;Getting for day &quot; + day.toString());
      return eventsForMonth[day] ?? [];
    }
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        appBar: AppBar(
          leading: IconButton(
            icon: Icon(
              LineIcons.chevronLeft,
              color: Colors.black,
            ),
            onPressed: () {
              Navigator.of(context).pop();
            },
          ),
          actions: [
            IconButton(
                icon: Icon(
                  LineIcons.plus,
                  color: Colors.black,
                ),
                onPressed: () =&gt; _addMeetup()),
          ],
          elevation: 1,
          title: Text(
            &quot;Meetups&quot;,
            style: TextStyle(color: Colors.black),
          ),
          backgroundColor: helpers.appBarColor,
          foregroundColor: Colors.black,
        ),
        body: Column(
          children: [
            TableCalendar(
              onPageChanged: (focusedDay) =&gt; {_loadMeetupsForMonth(focusedDay)},
              firstDay: DateTime.now(),
              lastDay: DateTime.utc(2050, 12, 31),
              focusedDay: DateTime.now(),
              onDaySelected: (selectedDay, focusedDay) {
                print(selectedDay);
              },
              eventLoader: (day) {
                return _getEventsForDay(day);
              },
            ), 
          ],
        ),
      );
    }
  
    @override
    initState() {
      eventsForMonth = new Map&lt;DateTime, List&lt;CalendarEvent&gt;&gt;();
      _loadMeetupsForMonth(DateTime.now());
      super.initState();
    }
  }
  
  class CalendarEvent {
    final String title;
    final String postedBy;
  
    CalendarEvent({required this.title, required this.postedBy});
  }
  </code></pre>
  <p>The error is:</p>
  <pre><code>Unhandled Exception: Null check operator used on a null value
  </code></pre>
  <p>Anyone have a solution?</p>