property_news_detail_entity.g.dart 2.4 KB

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