rewards_home_test_entity.g.dart 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import 'package:domain/generated/json/base/json_convert_content.dart';
  2. import 'package:domain/entity/rewards_home_test_entity.dart';
  3. RewardsHomeTestEntity $RewardsHomeTestEntityFromJson(
  4. Map<String, dynamic> json) {
  5. final RewardsHomeTestEntity rewardsHomeTestEntity = RewardsHomeTestEntity();
  6. final int? id = jsonConvert.convert<int>(json['id']);
  7. if (id != null) {
  8. rewardsHomeTestEntity.id = id;
  9. }
  10. final String? name = jsonConvert.convert<String>(json['name']);
  11. if (name != null) {
  12. rewardsHomeTestEntity.name = name;
  13. }
  14. final List<dynamic>? rewards = (json['rewards'] as List<dynamic>?)?.map(
  15. (e) => e).toList();
  16. if (rewards != null) {
  17. rewardsHomeTestEntity.rewards = rewards;
  18. }
  19. return rewardsHomeTestEntity;
  20. }
  21. Map<String, dynamic> $RewardsHomeTestEntityToJson(
  22. RewardsHomeTestEntity entity) {
  23. final Map<String, dynamic> data = <String, dynamic>{};
  24. data['id'] = entity.id;
  25. data['name'] = entity.name;
  26. data['rewards'] = entity.rewards;
  27. return data;
  28. }
  29. extension RewardsHomeTestEntityExtension on RewardsHomeTestEntity {
  30. RewardsHomeTestEntity copyWith({
  31. int? id,
  32. String? name,
  33. List<dynamic>? rewards,
  34. }) {
  35. return RewardsHomeTestEntity()
  36. ..id = id ?? this.id
  37. ..name = name ?? this.name
  38. ..rewards = rewards ?? this.rewards;
  39. }
  40. }