latest_news_page_entity.g.dart 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. import 'package:domain/generated/json/base/json_convert_content.dart';
  2. import 'package:domain/entity/latest_news_page_entity.dart';
  3. LatestNewsPageEntity $LatestNewsPageEntityFromJson(Map<String, dynamic> json) {
  4. final LatestNewsPageEntity latestNewsPageEntity = LatestNewsPageEntity();
  5. final int? count = jsonConvert.convert<int>(json['count']);
  6. if (count != null) {
  7. latestNewsPageEntity.count = count;
  8. }
  9. final int? page = jsonConvert.convert<int>(json['page']);
  10. if (page != null) {
  11. latestNewsPageEntity.page = page;
  12. }
  13. final int? limit = jsonConvert.convert<int>(json['limit']);
  14. if (limit != null) {
  15. latestNewsPageEntity.limit = limit;
  16. }
  17. final int? countPage = jsonConvert.convert<int>(json['count_page']);
  18. if (countPage != null) {
  19. latestNewsPageEntity.countPage = countPage;
  20. }
  21. final List<LatestNewsList>? list = (json['list'] as List<dynamic>?)?.map(
  22. (e) => jsonConvert.convert<LatestNewsList>(e) as LatestNewsList).toList();
  23. if (list != null) {
  24. latestNewsPageEntity.list = list;
  25. }
  26. return latestNewsPageEntity;
  27. }
  28. Map<String, dynamic> $LatestNewsPageEntityToJson(LatestNewsPageEntity entity) {
  29. final Map<String, dynamic> data = <String, dynamic>{};
  30. data['count'] = entity.count;
  31. data['page'] = entity.page;
  32. data['limit'] = entity.limit;
  33. data['count_page'] = entity.countPage;
  34. data['list'] = entity.list?.map((v) => v.toJson()).toList();
  35. return data;
  36. }
  37. extension LatestNewsPageEntityExtension on LatestNewsPageEntity {
  38. LatestNewsPageEntity copyWith({
  39. int? count,
  40. int? page,
  41. int? limit,
  42. int? countPage,
  43. List<LatestNewsList>? list,
  44. }) {
  45. return LatestNewsPageEntity()
  46. ..count = count ?? this.count
  47. ..page = page ?? this.page
  48. ..limit = limit ?? this.limit
  49. ..countPage = countPage ?? this.countPage
  50. ..list = list ?? this.list;
  51. }
  52. }
  53. LatestNewsList $LatestNewsListFromJson(Map<String, dynamic> json) {
  54. final LatestNewsList latestNewsList = LatestNewsList();
  55. final String? id = jsonConvert.convert<String>(json['id']);
  56. if (id != null) {
  57. latestNewsList.id = id;
  58. }
  59. final int? type = jsonConvert.convert<int>(json['type']);
  60. if (type != null) {
  61. latestNewsList.type = type;
  62. }
  63. final String? title = jsonConvert.convert<String>(json['title']);
  64. if (title != null) {
  65. latestNewsList.title = title;
  66. }
  67. final String? coverImage = jsonConvert.convert<String>(json['cover_image']);
  68. if (coverImage != null) {
  69. latestNewsList.coverImage = coverImage;
  70. }
  71. final String? content = jsonConvert.convert<String>(json['content']);
  72. if (content != null) {
  73. latestNewsList.content = content;
  74. }
  75. final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  76. if (createdAt != null) {
  77. latestNewsList.createdAt = createdAt;
  78. }
  79. return latestNewsList;
  80. }
  81. Map<String, dynamic> $LatestNewsListToJson(LatestNewsList entity) {
  82. final Map<String, dynamic> data = <String, dynamic>{};
  83. data['id'] = entity.id;
  84. data['type'] = entity.type;
  85. data['title'] = entity.title;
  86. data['cover_image'] = entity.coverImage;
  87. data['content'] = entity.content;
  88. data['created_at'] = entity.createdAt;
  89. return data;
  90. }
  91. extension LatestNewsListExtension on LatestNewsList {
  92. LatestNewsList copyWith({
  93. String? id,
  94. int? type,
  95. String? title,
  96. String? coverImage,
  97. String? content,
  98. String? createdAt,
  99. }) {
  100. return LatestNewsList()
  101. ..id = id ?? this.id
  102. ..type = type ?? this.type
  103. ..title = title ?? this.title
  104. ..coverImage = coverImage ?? this.coverImage
  105. ..content = content ?? this.content
  106. ..createdAt = createdAt ?? this.createdAt;
  107. }
  108. }