title: Flutter remove null values from list
body: <p>I have a <code>List</code> of <strong>optional</strong> <code>DateTimes</code>. So the List can actually have <code>null</code> values inside. But now I need to remove all these <code>null</code>-values, to get a <code>List&lt;DateTime</code>, instead of a <code>List&lt;DateTime?&gt;</code>. How is that possible?</p>
  <p>I tried it like this:</p>
  <pre><code>    List&lt;DateTime&gt; timesOfDayNotNull = timesOfDay.where((time) =&gt; time != null).toList();
  </code></pre>
  <p>But this is giving me:</p>
  <blockquote>
  <p>A value of type 'List&lt;DateTime?&gt;' can't be assigned to a variable of type 'List'.</p>
  </blockquote>
  <p>What am I missing here? Any help is appreciated!</p>