myposts_sale_rent_entity.g.dart 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import 'package:domain/generated/json/base/json_convert_content.dart';
  2. import 'package:domain/entity/myposts_sale_rent_entity.dart';
  3. MypostsSaleRentEntity $MypostsSaleRentEntityFromJson(
  4. Map<String, dynamic> json) {
  5. final MypostsSaleRentEntity mypostsSaleRentEntity = MypostsSaleRentEntity();
  6. final int? id = jsonConvert.convert<int>(json['id']);
  7. if (id != null) {
  8. mypostsSaleRentEntity.id = id;
  9. }
  10. final String? title = jsonConvert.convert<String>(json['title']);
  11. if (title != null) {
  12. mypostsSaleRentEntity.title = title;
  13. }
  14. final int? price = jsonConvert.convert<int>(json['price']);
  15. if (price != null) {
  16. mypostsSaleRentEntity.price = price;
  17. }
  18. final List<String>? resources = (json['resources'] as List<dynamic>?)?.map(
  19. (e) => jsonConvert.convert<String>(e) as String).toList();
  20. if (resources != null) {
  21. mypostsSaleRentEntity.resources = resources;
  22. }
  23. final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  24. if (createdAt != null) {
  25. mypostsSaleRentEntity.createdAt = createdAt;
  26. }
  27. final int? likesCount = jsonConvert.convert<int>(json['likes_count']);
  28. if (likesCount != null) {
  29. mypostsSaleRentEntity.likesCount = likesCount;
  30. }
  31. return mypostsSaleRentEntity;
  32. }
  33. Map<String, dynamic> $MypostsSaleRentEntityToJson(
  34. MypostsSaleRentEntity entity) {
  35. final Map<String, dynamic> data = <String, dynamic>{};
  36. data['id'] = entity.id;
  37. data['title'] = entity.title;
  38. data['price'] = entity.price;
  39. data['resources'] = entity.resources;
  40. data['created_at'] = entity.createdAt;
  41. data['likes_count'] = entity.likesCount;
  42. return data;
  43. }
  44. extension MypostsSaleRentEntityExtension on MypostsSaleRentEntity {
  45. MypostsSaleRentEntity copyWith({
  46. int? id,
  47. String? title,
  48. int? price,
  49. List<String>? resources,
  50. String? createdAt,
  51. int? likesCount,
  52. }) {
  53. return MypostsSaleRentEntity()
  54. ..id = id ?? this.id
  55. ..title = title ?? this.title
  56. ..price = price ?? this.price
  57. ..resources = resources ?? this.resources
  58. ..createdAt = createdAt ?? this.createdAt
  59. ..likesCount = likesCount ?? this.likesCount;
  60. }
  61. }