latest_news_detail_entity.g.dart 2.0 KB

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