title: Add dynamic maps to a list in a for loop
body: <p>I am having few maps (which are dynamic). I want to add those to a list (List&lt;Map&lt;String,dynamic&gt;&gt;) -&gt; like this. I tried to add by using .add but throwed an error</p>
  <pre><code>Error:
  type '_InternalLinkedHashMap&lt;dynamic, dynamic&gt;' is not a subtype of type 'List&lt;Map&lt;dynamic, dynamic&gt;&gt;' of 'function result'
  </code></pre>
  <p>Dart Code:</p>
  <pre><code>    final List&lt;Map&lt;String, dynamic&gt;&gt; teamName = [{'teamName': 'Spartans'}, {'teamName': 300}];
      final List&lt;Map&lt;String, dynamic&gt;&gt; captainName = [{'captainName': 'ABC'}, {'captainName': 'XYZ'}];
      final List&lt;Map&lt;String, dynamic&gt;&gt; correctValue = [];
          for (var i = 0; i &lt; teamName.length; i++) {
            for (var j = i; j &lt; captainName.length; j++) {
              final Map&lt;String, dynamic&gt; currentValue = {
                'teamname': teamName[i]['teamName'],
                'captainname': captainName[j]['captainName']
              };
              correctValue.add(currentValue);
              break;
            }
          }
          print('end result is $correctValue');
  </code></pre>
  <p>I want my result to be like<br>
  <code>[{teamName: Spartans, captainName: ABC}, {teamName: 300, captainName: XYZ}]</code></p>