myposts_sale_rent_entity.g.dart 2.1 KB

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