@JsonSerializable()
class BannerDetailModel extends BannerModel {
  const BannerDetailModel({
		...
    required this.contents,
  });
 
  @_Converter()
  final List<Contents> contents;
	...
}
 
class _Converter implements JsonConverter<Contents, Object> {
  const _Converter();
 
  @override
  Contents fromJson(Object json) {
    if (json is Map<String, dynamic>) {
      final type = json['type'];
      if (...) {
        return ImageContents.fromJson(json);
      }
      if (...) {
        return ProductContents.fromJson(json);
      }
    }
 
    throw Exception();
  }
  ...
}
 
sealed class Contents {}
 
@JsonSerializable()
class ImageContents implements Contents {
  const ImageContents({
	...
  });
 
	...
  factory ImageContents.fromJson(Map<String, dynamic> json) =>
      _$ImageContentsFromJson(json);
}
 
@JsonSerializable()
class ProductContents implements Contents {
  const ProductContents({
	...
  });
 
 
	...
  factory ProductContents.fromJson(Map<String, dynamic> json) =>
      _$ProductContentsFromJson(json);
}