latest_news_detail_entity.g.dart 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import 'package:domain/generated/json/base/json_convert_content.dart';
  2. import 'package:domain/entity/latest_news_detail_entity.dart';
  3. LatestNewsDetailEntity $LatestNewsDetailEntityFromJson(
  4. Map<String, dynamic> json) {
  5. final LatestNewsDetailEntity latestNewsDetailEntity = LatestNewsDetailEntity();
  6. final String? id = jsonConvert.convert<String>(json['id']);
  7. if (id != null) {
  8. latestNewsDetailEntity.id = id;
  9. }
  10. final int? type = jsonConvert.convert<int>(json['type']);
  11. if (type != null) {
  12. latestNewsDetailEntity.type = type;
  13. }
  14. final String? title = jsonConvert.convert<String>(json['title']);
  15. if (title != null) {
  16. latestNewsDetailEntity.title = title;
  17. }
  18. final String? coverImage = jsonConvert.convert<String>(json['cover_image']);
  19. if (coverImage != null) {
  20. latestNewsDetailEntity.coverImage = coverImage;
  21. }
  22. final String? content = jsonConvert.convert<String>(json['content']);
  23. if (content != null) {
  24. latestNewsDetailEntity.content = content;
  25. }
  26. final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  27. if (createdAt != null) {
  28. latestNewsDetailEntity.createdAt = createdAt;
  29. }
  30. return latestNewsDetailEntity;
  31. }
  32. Map<String, dynamic> $LatestNewsDetailEntityToJson(
  33. LatestNewsDetailEntity entity) {
  34. final Map<String, dynamic> data = <String, dynamic>{};
  35. data['id'] = entity.id;
  36. data['type'] = entity.type;
  37. data['title'] = entity.title;
  38. data['cover_image'] = entity.coverImage;
  39. data['content'] = entity.content;
  40. data['created_at'] = entity.createdAt;
  41. return data;
  42. }
  43. extension LatestNewsDetailEntityExtension on LatestNewsDetailEntity {
  44. LatestNewsDetailEntity copyWith({
  45. String? id,
  46. int? type,
  47. String? title,
  48. String? coverImage,
  49. String? content,
  50. String? createdAt,
  51. }) {
  52. return LatestNewsDetailEntity()
  53. ..id = id ?? this.id
  54. ..type = type ?? this.type
  55. ..title = title ?? this.title
  56. ..coverImage = coverImage ?? this.coverImage
  57. ..content = content ?? this.content
  58. ..createdAt = createdAt ?? this.createdAt;
  59. }
  60. }