title: How to cast an array from Firestore in dart
body: <p>I have a class</p>
  <pre><code>UserModel{
  late final List&lt;UserEmail&gt; emails;
  }
  </code></pre>
  <p>I trying to retrieve an array from Firestore.</p>
  <pre><code>UserModel.fromJson(    emails = json[emailsKey] != null
              ? (json[emailsKey] as List&lt;Map&lt;String,dynamic&gt;&gt;).map((Map&lt;String, dynamic&gt; email) =&gt; UserEmail.fromJson(email)).toList()
              : &lt;UserEmail&gt;[],
  </code></pre>
  <p>The <code>emailsKey</code> is the key to emails array in Firestore..</p>
  <p>The error I'm getting back is</p>
  <pre><code>Failed: type 'List&lt;dynamic&gt;' is not a subtype of type 'List&lt;Map&lt;String, dynamic&gt;&gt;' in type cast&lt;…&gt;
  </code></pre>
  <p>I'm not sure why my casting isn't working (at runtime).
  Any ideas</p>