title: Obtaining Map<String, Element> rather than Map<dynamic, dynamic>
body: <p>We start with a class <code>Element</code> for a member of the periodic table.</p>
  <pre><code>import 'dart:convert' as JSON;
  
  class Element {
    String name;
    Element({this.name = &quot;&quot;});
    String toString() {
      return this.name.toString();
    }
  }
  </code></pre>
  <p>We can then decode a JSON string</p>
  <pre><code>void f1() {
    var jsonStr = &quot;&quot;&quot;{ &quot;Na&quot;: { &quot;name&quot;: &quot;Sodium&quot; }, &quot;Ca&quot;: { &quot;name&quot;: &quot;Calcium&quot; } }&quot;&quot;&quot;;
  
    final json = JSON.jsonDecode(jsonStr);
    print(json.runtimeType);  // MappedListIterable&lt;dynamic, dynamic&gt;
  
    final elements = json.map((key, value) =&gt; MapEntry(key, Element(name: value['name'])));
    
    print(elements.runtimeType);  // _InternalLinkedHashMap&lt;dynamic, dynamic&gt;
  }
  </code></pre>
  <p>but suppose we want to specify the type of the result:</p>
  <pre><code>Map&lt;String, Element&gt; f3() {
    var jsonStr = &quot;&quot;&quot;{ &quot;Na&quot;: { &quot;name&quot;: &quot;Sodium&quot; }, &quot;Ca&quot;: { &quot;name&quot;: &quot;Calcium&quot; } }&quot;&quot;&quot;;
  
    final json = JSON.jsonDecode(jsonStr);
  
    final elements = Map&lt;String, Element&gt;.fromIterable(json,
      key: (k, v) =&gt; k,
      value: (k, v) =&gt; Element.fromJson(name: v['name'])
    );
  
    return elements;
  }
  </code></pre>
  <p>How can I get around the following error?</p>
  <pre><code>Error: The argument type 'String Function(dynamic, dynamic)' can't be assigned
  to the parameter type 'String Function(dynamic)?'.
  </code></pre>
  <p>to ensure that the returned object is of type <code>Map&lt;String, Element&gt;</code>?</p>