rewards_home_entity.g.dart 4.4 KB

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