import 'package:domain/generated/json/base/json_convert_content.dart'; import 'package:domain/entity/rewards_search_entity.dart'; RewardsSearchEntity $RewardsSearchEntityFromJson(Map json) { final RewardsSearchEntity rewardsSearchEntity = RewardsSearchEntity(); final List? recent = (json['recent'] as List?)?.map( (e) => jsonConvert.convert(e) as String).toList(); if (recent != null) { rewardsSearchEntity.recent = recent; } final List? trending = (json['trending'] as List?)?.map( (e) => jsonConvert.convert(e) as String).toList(); if (trending != null) { rewardsSearchEntity.trending = trending; } final List? rewards = (json['rewards'] as List< dynamic>?) ?.map( (e) => jsonConvert.convert(e) as RewardsSearchRewards) .toList(); if (rewards != null) { rewardsSearchEntity.rewards = rewards; } return rewardsSearchEntity; } Map $RewardsSearchEntityToJson(RewardsSearchEntity entity) { final Map data = {}; data['recent'] = entity.recent; data['trending'] = entity.trending; data['rewards'] = entity.rewards.map((v) => v.toJson()).toList(); return data; } extension RewardsSearchEntityExtension on RewardsSearchEntity { RewardsSearchEntity copyWith({ List? recent, List? trending, List? rewards, }) { return RewardsSearchEntity() ..recent = recent ?? this.recent ..trending = trending ?? this.trending ..rewards = rewards ?? this.rewards; } } RewardsSearchRewards $RewardsSearchRewardsFromJson(Map json) { final RewardsSearchRewards rewardsSearchRewards = RewardsSearchRewards(); final int? id = jsonConvert.convert(json['id']); if (id != null) { rewardsSearchRewards.id = id; } final String? name = jsonConvert.convert(json['name']); if (name != null) { rewardsSearchRewards.name = name; } final List? resources = (json['resources'] as List?)?.map( (e) => jsonConvert.convert(e) as String).toList(); if (resources != null) { rewardsSearchRewards.resources = resources; } final int? originalPoint = jsonConvert.convert(json['original_point']); if (originalPoint != null) { rewardsSearchRewards.originalPoint = originalPoint; } final int? point = jsonConvert.convert(json['point']); if (point != null) { rewardsSearchRewards.point = point; } return rewardsSearchRewards; } Map $RewardsSearchRewardsToJson(RewardsSearchRewards entity) { final Map data = {}; data['id'] = entity.id; data['name'] = entity.name; data['resources'] = entity.resources; data['original_point'] = entity.originalPoint; data['point'] = entity.point; return data; } extension RewardsSearchRewardsExtension on RewardsSearchRewards { RewardsSearchRewards copyWith({ int? id, String? name, List? resources, int? originalPoint, int? point, }) { return RewardsSearchRewards() ..id = id ?? this.id ..name = name ?? this.name ..resources = resources ?? this.resources ..originalPoint = originalPoint ?? this.originalPoint ..point = point ?? this.point; } }