title: Exception: type 'String' is not a subtype of type 'Map<String, dynamic>
body: <p><strong>Exception: type 'String' is not a subtype of type 'Map&lt;String, dynamic&gt;'</strong></p>
  <pre><code>{&quot;collection&quot;:{&quot;data&quot;:&quot;{\&quot;id\&quot;: 1, \&quot;name\&quot;: \&quot;Marko\&quot;, \&quot;picture\&quot;: 
  \&quot;https://lh3.googleusercontent.com/a-/AAuE7mC1vqaKk_Eylt-fcKgJxuN96yQ7dsd2dBdsdsViK959TKsHQ=s96- 
  c\&quot;}&quot;,&quot;statusCode&quot;:202,&quot;version&quot;:&quot;1.0&quot;}}
  </code></pre>
  <p>This is the above json and i want to put it at User pojo class only the [data].</p>
  <p>But it threw the above exception type.</p>
  <pre><code>class UserCollection {
    final User data;
    final int statusCode;
    final String version;
  
   UserCollection({this.data, this.statusCode, this.version});
  
  factory UserCollection.fromJson(Map&lt;String, dynamic&gt; json) {
   return UserCollection(
      statusCode: json['statusCode'] as int,
      data: User.fromJson(json['data']) ,
      version: json['version'] as String );
  }
  
   Map&lt;String, dynamic&gt; toJson() {
   final Map&lt;String, dynamic&gt; data = new Map&lt;String, dynamic&gt;();
   data['data'] = this.data;
   data['statusCode'] = this.statusCode;
   data['version'] = this.version;
   return data;
   }
  }
  </code></pre>
  <p>User Pojo class</p>
  <pre><code>@JsonSerializable()
  class User {
  final int id;
   final String sub;
   final String home;
   final String work;
   final String name;
   final String mobileNo;
   final String email;
   final String favMechId;
   final String appVersionCode;
   final String picture;
   final String serverTime;
   final String dateCreated;
   final String dateModified;
   final String fcmTokenId;
  
   User(
    {this.id,
    this.sub,
    this.home,
    this.work,
    this.name,
    this.mobileNo,
    this.email,
    this.favMechId,
    this.appVersionCode,
    this.picture,
    this.serverTime,
    this.dateCreated,
    this.dateModified,
    this.fcmTokenId});
  
  
  
    factory User.fromJson(Map&lt;String, dynamic&gt; json) =&gt; _$UserFromJson(json);
  
    Map&lt;String,dynamic&gt; toJson() =&gt; _$UserToJson(this); 
  </code></pre>
  <p>I have referring this medium site for clarity, <a href="https://medium.com/flutter-community/parsing-complex-json-in-flutter-747c46655f51" rel="noreferrer">medium flutter json</a></p>
  <p>but in vein more than 4 hours  i couldn't what was wrong.
  If change the User.from() to String then it's okay. But i need to parse the [data] from json to User pojo class.</p>