title: How to properly serialize/deserialize a map in dart/flutter?
body: <p>Can you please show how to serialize/desierialize a map&lt;> to/from json in dart? For example, here's a simple data Class:</p>
  
  <pre><code>class SimpleData {
    int _blah;
    String _str;
  
    SimpleData([this._blah, this._str]);
  
    SimpleData.fromJson(Map&lt;String, dynamic&gt; json) {
      _blah = json['b'];
      _str = json['s'];
    }
  
    Map&lt;String, dynamic&gt; toJson() =&gt; {
      'b' : _blah,
      's' : _str,
    };
  }
  </code></pre>
  
  <p>Here's the SimpleData class used in a map:</p>
  
  <pre><code>class MapTest {
    Map&lt;int, SimpleData&gt; _mapHell = Map&lt;int, SimpleData&gt;();
  
    MapTest() {
      _mapHell[1] = SimpleData(42, "Astfgl");
      _mapHell[666] = SimpleData(1234, "Vassenego");
    }
  
    MapTest.fromJson(Map&lt;String, dynamic&gt; json) {
      _mapHell = jsonDecode(json['coworkers']);
    }
  
    Map&lt;String, dynamic&gt; toJson() =&gt; {
      'coworkers' : jsonEncode(_mapHell),
    };
  }
  </code></pre>
  
  <p>Now, when calling <code>MapTest.toJson()</code>, the following error is thrown:</p>
  
  <blockquote>
    <p>Converting object to an encodable object failed: _LinkedHashMap len:2</p>
  </blockquote>
  
  <p>Do you have any ideas whats wrong with the <code>toJson()/fromJson()</code> methods? 
  Thank you.</p>