rewards_home_tes_entity.g.dart 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. import 'package:domain/generated/json/base/json_convert_content.dart';
  2. import 'package:domain/entity/rewards_home_tes_entity.dart';
  3. RewardsHomeTesEntity $RewardsHomeTesEntityFromJson(Map<String, dynamic> json) {
  4. final RewardsHomeTesEntity rewardsHomeTesEntity = RewardsHomeTesEntity();
  5. final double? id = jsonConvert.convert<double>(json['id']);
  6. if (id != null) {
  7. rewardsHomeTesEntity.id = id;
  8. }
  9. final String? name = jsonConvert.convert<String>(json['name']);
  10. if (name != null) {
  11. rewardsHomeTesEntity.name = name;
  12. }
  13. final List<RewardsHomeTesRewards>? rewards = (json['rewards'] as List<
  14. dynamic>?)
  15. ?.map(
  16. (e) =>
  17. jsonConvert.convert<RewardsHomeTesRewards>(e) as RewardsHomeTesRewards)
  18. .toList();
  19. if (rewards != null) {
  20. rewardsHomeTesEntity.rewards = rewards;
  21. }
  22. return rewardsHomeTesEntity;
  23. }
  24. Map<String, dynamic> $RewardsHomeTesEntityToJson(RewardsHomeTesEntity entity) {
  25. final Map<String, dynamic> data = <String, dynamic>{};
  26. data['id'] = entity.id;
  27. data['name'] = entity.name;
  28. data['rewards'] = entity.rewards.map((v) => v.toJson()).toList();
  29. return data;
  30. }
  31. extension RewardsHomeTesEntityExtension on RewardsHomeTesEntity {
  32. RewardsHomeTesEntity copyWith({
  33. double? id,
  34. String? name,
  35. List<RewardsHomeTesRewards>? rewards,
  36. }) {
  37. return RewardsHomeTesEntity()
  38. ..id = id ?? this.id
  39. ..name = name ?? this.name
  40. ..rewards = rewards ?? this.rewards;
  41. }
  42. }
  43. RewardsHomeTesRewards $RewardsHomeTesRewardsFromJson(
  44. Map<String, dynamic> json) {
  45. final RewardsHomeTesRewards rewardsHomeTesRewards = RewardsHomeTesRewards();
  46. final double? id = jsonConvert.convert<double>(json['id']);
  47. if (id != null) {
  48. rewardsHomeTesRewards.id = id;
  49. }
  50. final String? name = jsonConvert.convert<String>(json['name']);
  51. if (name != null) {
  52. rewardsHomeTesRewards.name = name;
  53. }
  54. final List<String>? resources = (json['resources'] as List<dynamic>?)?.map(
  55. (e) => jsonConvert.convert<String>(e) as String).toList();
  56. if (resources != null) {
  57. rewardsHomeTesRewards.resources = resources;
  58. }
  59. final double? originalPoint = jsonConvert.convert<double>(
  60. json['original_point']);
  61. if (originalPoint != null) {
  62. rewardsHomeTesRewards.originalPoint = originalPoint;
  63. }
  64. final double? point = jsonConvert.convert<double>(json['point']);
  65. if (point != null) {
  66. rewardsHomeTesRewards.point = point;
  67. }
  68. return rewardsHomeTesRewards;
  69. }
  70. Map<String, dynamic> $RewardsHomeTesRewardsToJson(
  71. RewardsHomeTesRewards entity) {
  72. final Map<String, dynamic> data = <String, dynamic>{};
  73. data['id'] = entity.id;
  74. data['name'] = entity.name;
  75. data['resources'] = entity.resources;
  76. data['original_point'] = entity.originalPoint;
  77. data['point'] = entity.point;
  78. return data;
  79. }
  80. extension RewardsHomeTesRewardsExtension on RewardsHomeTesRewards {
  81. RewardsHomeTesRewards copyWith({
  82. double? id,
  83. String? name,
  84. List<String>? resources,
  85. double? originalPoint,
  86. double? point,
  87. }) {
  88. return RewardsHomeTesRewards()
  89. ..id = id ?? this.id
  90. ..name = name ?? this.name
  91. ..resources = resources ?? this.resources
  92. ..originalPoint = originalPoint ?? this.originalPoint
  93. ..point = point ?? this.point;
  94. }
  95. }