title: Flutter: inheritance, what i need know and how, an implemented method in parent that i need to use it in child and add more implementation on it
body: <ul>
  <li>This is the parent which has an implemented method</li>
  </ul>
  <pre><code>abstract class CommonModel {
    int id;
    String name;
  ....
    Map&lt;String, dynamic&gt; toJson(){
       final Map&lt;String, dynamic&gt; data = new Map&lt;String, dynamic&gt;();
      data['Id'] = this.id;
      data['Name'] = this.name;
      return data;
    }
  }
  </code></pre>
  <ul>
  <li>and this the the child class which i need to use the method [toJson] on it with its implementation and add more data.</li>
  </ul>
  <pre><code>
  import 'package:Elnota/models/governorate.dart';
  import  'package:Elnota/models/abstract_common_model.dart';
  
  class Centeral extends CommonModel{
   
    Governorate gov;
  
    Centeral({
      int id, 
      String name, 
      this.gov}) : super(id:id, name:name);
  
    Centeral.fromJson(Map&lt;String, dynamic&gt; json) :super.fromJson(json){
      gov = json['Gov'] != null ? new Governorate.fromJson(json['Gov']) : null;
    }
  
  
    Map&lt;String, dynamic&gt; toJson() {
     final Map&lt;String, dynamic&gt; data = new Map&lt;String, dynamic&gt;();
      data['Gov'] = this.gov;
    }
  
    
  }
  </code></pre>