property_news_detail_entity.g.dart 2.4 KB

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