title: Flutter: Not able to use nested models with Entities. (Entities, Models, Equatable, Flutter, Dart, json_serializable,Json Serialization)
body: <p>I have two file for a single data i.e Entity and Model. To separate the entire logic from each other and to follow best practices.
  Whenever I am trying to use nested Entities and parsing through @JsonSerializable it's showing me error.</p>
  <p>Note: I have tried @JsonConverter too. It's not working.</p>
  <p>I'm sure I'm missing something over there but can't get it.
  <strong>Please help.</strong></p>
  <p>test_entity.dart</p>
  <pre><code>class TestEntity extends Equatable {
  final String id;
  final List&lt;AddressEntity&gt; address;
  
  const TestEntity({
  required this.id,
  required this.address,
  });
  @override
  List&lt;Object?&gt; get props =&gt; [
      id,
      address,
    ];
  }
  </code></pre>
  <p>test_model.dart</p>
  <pre><code>part 'test_model.g.dart';
  
  @JsonSerializable(explicitToJson: true)
  class TestModel extends TestEntity {
  const TestModel({
  required String id,
  required List&lt;AddressModel&gt; address,
  }) : super(
        id: id,
        address: address,
      );
  factory TestModel.fromJson(Map&lt;String, dynamic&gt; json) =&gt;
    _$TestModelFromJson(json);
  
  Map&lt;String, dynamic&gt; toJson() =&gt; _$TestModelToJson(this);
  }
  </code></pre>
  <p>address_entity.dart</p>
  <pre><code>class AddressEntity extends Equatable {
   final String id;
   final String title;
  
  const AddressEntity({
   required this.id,
   required this.title,
  });
  @override
  List&lt;Object?&gt; get props =&gt; [
      id,
      title,
    ];
  }
  </code></pre>
  <p>address_model.dart</p>
  <pre><code>part 'address_model.g.dart';
  
  @JsonSerializable()
  class AddressModel {
   final String id;
   final String title;
  
   AddressModel({
    required this.id,
    required this.title,
   });
  
   factory AddressModel.fromJson(Map&lt;String, dynamic&gt; json) =&gt;
      _$AddressModelFromJson(json);
  
   Map&lt;String, dynamic&gt; toJson() =&gt; _$AddressModelToJson(this);
   }
  </code></pre>
  <p>When I use AddressModel instead AddressEntity</p>
  <p><a href="https://i.stack.imgur.com/c6oY2.png" rel="nofollow noreferrer">Here is the Snap of Code</a></p>
  <p><a href="https://i.stack.imgur.com/NWAMZ.png" rel="nofollow noreferrer">Also This Code:</a></p>