rewards_home_entity.g.dart 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. import 'package:domain/generated/json/base/json_convert_content.dart';
  2. import 'package:domain/entity/rewards_home_entity.dart';
  3. RewardsHomeEntity $RewardsHomeEntityFromJson(Map<String, dynamic> json) {
  4. final RewardsHomeEntity rewardsHomeEntity = RewardsHomeEntity();
  5. final List<RewardsHomeData>? data = (json['data'] as List<dynamic>?)
  6. ?.map(
  7. (e) => jsonConvert.convert<RewardsHomeData>(e) as RewardsHomeData)
  8. .toList();
  9. if (data != null) {
  10. rewardsHomeEntity.data = data;
  11. }
  12. final String? message = jsonConvert.convert<String>(json['message']);
  13. if (message != null) {
  14. rewardsHomeEntity.message = message;
  15. }
  16. final int? code = jsonConvert.convert<int>(json['code']);
  17. if (code != null) {
  18. rewardsHomeEntity.code = code;
  19. }
  20. return rewardsHomeEntity;
  21. }
  22. Map<String, dynamic> $RewardsHomeEntityToJson(RewardsHomeEntity entity) {
  23. final Map<String, dynamic> data = <String, dynamic>{};
  24. data['data'] = entity.data.map((v) => v.toJson()).toList();
  25. data['message'] = entity.message;
  26. data['code'] = entity.code;
  27. return data;
  28. }
  29. extension RewardsHomeEntityExtension on RewardsHomeEntity {
  30. RewardsHomeEntity copyWith({
  31. List<RewardsHomeData>? data,
  32. String? message,
  33. int? code,
  34. }) {
  35. return RewardsHomeEntity()
  36. ..data = data ?? this.data
  37. ..message = message ?? this.message
  38. ..code = code ?? this.code;
  39. }
  40. }
  41. RewardsHomeData $RewardsHomeDataFromJson(Map<String, dynamic> json) {
  42. final RewardsHomeData rewardsHomeData = RewardsHomeData();
  43. final int? id = jsonConvert.convert<int>(json['id']);
  44. if (id != null) {
  45. rewardsHomeData.id = id;
  46. }
  47. final String? name = jsonConvert.convert<String>(json['name']);
  48. if (name != null) {
  49. rewardsHomeData.name = name;
  50. }
  51. final List<RewardsHomeDataRewards>? rewards = (json['rewards'] as List<
  52. dynamic>?)
  53. ?.map(
  54. (e) =>
  55. jsonConvert.convert<RewardsHomeDataRewards>(e) as RewardsHomeDataRewards)
  56. .toList();
  57. if (rewards != null) {
  58. rewardsHomeData.rewards = rewards;
  59. }
  60. return rewardsHomeData;
  61. }
  62. Map<String, dynamic> $RewardsHomeDataToJson(RewardsHomeData entity) {
  63. final Map<String, dynamic> data = <String, dynamic>{};
  64. data['id'] = entity.id;
  65. data['name'] = entity.name;
  66. data['rewards'] = entity.rewards.map((v) => v.toJson()).toList();
  67. return data;
  68. }
  69. extension RewardsHomeDataExtension on RewardsHomeData {
  70. RewardsHomeData copyWith({
  71. int? id,
  72. String? name,
  73. List<RewardsHomeDataRewards>? rewards,
  74. }) {
  75. return RewardsHomeData()
  76. ..id = id ?? this.id
  77. ..name = name ?? this.name
  78. ..rewards = rewards ?? this.rewards;
  79. }
  80. }
  81. RewardsHomeDataRewards $RewardsHomeDataRewardsFromJson(
  82. Map<String, dynamic> json) {
  83. final RewardsHomeDataRewards rewardsHomeDataRewards = RewardsHomeDataRewards();
  84. final int? id = jsonConvert.convert<int>(json['id']);
  85. if (id != null) {
  86. rewardsHomeDataRewards.id = id;
  87. }
  88. final String? name = jsonConvert.convert<String>(json['name']);
  89. if (name != null) {
  90. rewardsHomeDataRewards.name = name;
  91. }
  92. final List<String>? resources = (json['resources'] as List<dynamic>?)?.map(
  93. (e) => jsonConvert.convert<String>(e) as String).toList();
  94. if (resources != null) {
  95. rewardsHomeDataRewards.resources = resources;
  96. }
  97. final int? originalPoint = jsonConvert.convert<int>(json['original_point']);
  98. if (originalPoint != null) {
  99. rewardsHomeDataRewards.originalPoint = originalPoint;
  100. }
  101. final int? point = jsonConvert.convert<int>(json['point']);
  102. if (point != null) {
  103. rewardsHomeDataRewards.point = point;
  104. }
  105. return rewardsHomeDataRewards;
  106. }
  107. Map<String, dynamic> $RewardsHomeDataRewardsToJson(
  108. RewardsHomeDataRewards entity) {
  109. final Map<String, dynamic> data = <String, dynamic>{};
  110. data['id'] = entity.id;
  111. data['name'] = entity.name;
  112. data['resources'] = entity.resources;
  113. data['original_point'] = entity.originalPoint;
  114. data['point'] = entity.point;
  115. return data;
  116. }
  117. extension RewardsHomeDataRewardsExtension on RewardsHomeDataRewards {
  118. RewardsHomeDataRewards copyWith({
  119. int? id,
  120. String? name,
  121. List<String>? resources,
  122. int? originalPoint,
  123. int? point,
  124. }) {
  125. return RewardsHomeDataRewards()
  126. ..id = id ?? this.id
  127. ..name = name ?? this.name
  128. ..resources = resources ?? this.resources
  129. ..originalPoint = originalPoint ?? this.originalPoint
  130. ..point = point ?? this.point;
  131. }
  132. }