title: How to reuse model as parent
body: <p>I get a <code>json</code> response in sample format like below</p>
  <pre><code>// call 1 : /all-users
  {
    &quot;success&quot;: true,
    &quot;message&quot;: &quot;All Users list&quot;,
    &quot;data&quot;: [{
      &quot;code&quot;: &quot;USR001&quot;,
      &quot;name&quot;: &quot;User One&quot;
    }]
  }
  
  
  // call 2 - /user-details/USR001
  {
    &quot;success&quot;: true,
    &quot;message&quot;: &quot;User Details of USR001&quot;,
    &quot;data&quot;: {
      &quot;code&quot;: &quot;USR001&quot;,
      &quot;firstName&quot;: &quot;User&quot;,
      &quot;lastName&quot;: &quot;One&quot;,
      &quot;email&quot;: &quot;userOne@email.com&quot;,
    }
  }
  </code></pre>
  <p>And my <code>ApiResponse</code> model is</p>
  <pre><code>class ApiResponse {
    bool success;
    String message;
    List&lt;Data&gt; data;
  
    ApiResponse({this.success, this.message, this.data});
  
    ApiResponse.fromJson(Map&lt;String, dynamic&gt; json) {
      success = json['success'];
      message = json['message'];
      if (json['data'] != null) {
        data = new List&lt;Data&gt;();
        json['data'].forEach((v) {
          data.add(new Data.fromJson(v));
        });
      }
    }
  }
  </code></pre>
  <p>The <code>data</code> in the response may be an object or array depends on the call. I would like to reuse the <code>ApiResponse</code> model for both calls by extending the <code>data</code> as separate models. But i don't know how to do it.</p>