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