title: How to implement inheritance in dart?
body: <p>I want to have a class that inherits some properties from another class in Dart. What's the best way to do it?</p>
  
  <p>This is my parent class : </p>
  
  <pre><code>class Photo {
    final String id;
    final String owner, server, secret, title;
    final int farm, isfamily, ispublic, isfriend;
    final String url;
  
    Photo(
        {this.id,
        this.owner,
        this.secret,
        this.server,
        this.farm,
        this.title,
        this.ispublic,
        this.isfriend,
        this.isfamily,
        this.url});
  
    factory Photo.fromJson(Map&lt;String, dynamic&gt; parsedJson) {
      return new Photo(
          id: parsedJson['id'],
          owner: parsedJson['owner'],
          secret: parsedJson['secret'],
          server: parsedJson['server'],
          farm: parsedJson['farm'],
          title: parsedJson['title'],
          ispublic: parsedJson['ispublic'],
          isfriend: parsedJson['isfriend'],
          isfamily: parsedJson['isfamily'],
          url: parsedJson['url_m']);
    }
  } 
  </code></pre>
  
  <p>This is the child class that i want to create: </p>
  
  <pre><code>class gPhoto : Photo //inherits Photo
  {
    string ownername; 
    string dateadded; 
  
    gPhoto(
            {this.ownername,
             this.dateadded
            });
  
    factory gPhoto.fromJson(Map&lt;String, dynamic&gt; parsedJson) {
  
          return new Photo(
          ownername: parsedJson['ownername'], 
          dateadded: parsedJson['dateadded'']);
  }
  </code></pre>
  
  <p>Will this work? the factory from the Photo class will work with my new class or do i have to create a separate class for gPhoto in order to map the json? </p>