latest_news_page_entity.g.dart 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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>?)
  22. ?.map(
  23. (e) => jsonConvert.convert<LatestNewsList>(e) as LatestNewsList)
  24. .toList();
  25. if (list != null) {
  26. latestNewsPageEntity.list = list;
  27. }
  28. return latestNewsPageEntity;
  29. }
  30. Map<String, dynamic> $LatestNewsPageEntityToJson(LatestNewsPageEntity entity) {
  31. final Map<String, dynamic> data = <String, dynamic>{};
  32. data['count'] = entity.count;
  33. data['page'] = entity.page;
  34. data['limit'] = entity.limit;
  35. data['count_page'] = entity.countPage;
  36. data['list'] = entity.list?.map((v) => v.toJson()).toList();
  37. return data;
  38. }
  39. extension LatestNewsPageEntityExtension on LatestNewsPageEntity {
  40. LatestNewsPageEntity copyWith({
  41. int? count,
  42. int? page,
  43. int? limit,
  44. int? countPage,
  45. List<LatestNewsList>? list,
  46. }) {
  47. return LatestNewsPageEntity()
  48. ..count = count ?? this.count
  49. ..page = page ?? this.page
  50. ..limit = limit ?? this.limit
  51. ..countPage = countPage ?? this.countPage
  52. ..list = list ?? this.list;
  53. }
  54. }
  55. LatestNewsList $LatestNewsListFromJson(Map<String, dynamic> json) {
  56. final LatestNewsList latestNewsList = LatestNewsList();
  57. final String? id = jsonConvert.convert<String>(json['id']);
  58. if (id != null) {
  59. latestNewsList.id = id;
  60. }
  61. final int? type = jsonConvert.convert<int>(json['type']);
  62. if (type != null) {
  63. latestNewsList.type = type;
  64. }
  65. final String? title = jsonConvert.convert<String>(json['title']);
  66. if (title != null) {
  67. latestNewsList.title = title;
  68. }
  69. final String? coverImage = jsonConvert.convert<String>(json['cover_image']);
  70. if (coverImage != null) {
  71. latestNewsList.coverImage = coverImage;
  72. }
  73. final String? content = jsonConvert.convert<String>(json['content']);
  74. if (content != null) {
  75. latestNewsList.content = content;
  76. }
  77. final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  78. if (createdAt != null) {
  79. latestNewsList.createdAt = createdAt;
  80. }
  81. return latestNewsList;
  82. }
  83. Map<String, dynamic> $LatestNewsListToJson(LatestNewsList entity) {
  84. final Map<String, dynamic> data = <String, dynamic>{};
  85. data['id'] = entity.id;
  86. data['type'] = entity.type;
  87. data['title'] = entity.title;
  88. data['cover_image'] = entity.coverImage;
  89. data['content'] = entity.content;
  90. data['created_at'] = entity.createdAt;
  91. return data;
  92. }
  93. extension LatestNewsListExtension on LatestNewsList {
  94. LatestNewsList copyWith({
  95. String? id,
  96. int? type,
  97. String? title,
  98. String? coverImage,
  99. String? content,
  100. String? createdAt,
  101. }) {
  102. return LatestNewsList()
  103. ..id = id ?? this.id
  104. ..type = type ?? this.type
  105. ..title = title ?? this.title
  106. ..coverImage = coverImage ?? this.coverImage
  107. ..content = content ?? this.content
  108. ..createdAt = createdAt ?? this.createdAt;
  109. }
  110. }