title: How to convert a List<String?> to List<String> in null safe Dart?
body: <p>I have a dart list:</p>
  <pre><code>List&lt;String?&gt; vals;
  </code></pre>
  <p>I want to remove any null values and convert it to a <code>List&lt;String&gt;</code>.
  I've tried:</p>
  <pre><code>List&lt;String&gt; removeNulls(List&lt;String?&gt; list) {
    return list.where((c) =&gt; c != null).toList() as List&lt;String&gt;;
  }
  </code></pre>
  <p>At run time I'm getting the following error:</p>
  <pre><code>List&lt;String?&gt;' is not a subtype of type 'List&lt;String&gt;?'
  </code></pre>
  <p>What is the correct way to resolve this?</p>