123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- import 'package:domain/generated/json/base/json_convert_content.dart';
- import 'package:domain/entity/rewards_home_tes_entity.dart';
- RewardsHomeTesEntity $RewardsHomeTesEntityFromJson(Map<String, dynamic> json) {
- final RewardsHomeTesEntity rewardsHomeTesEntity = RewardsHomeTesEntity();
- final double? id = jsonConvert.convert<double>(json['id']);
- if (id != null) {
- rewardsHomeTesEntity.id = id;
- }
- final String? name = jsonConvert.convert<String>(json['name']);
- if (name != null) {
- rewardsHomeTesEntity.name = name;
- }
- final List<RewardsHomeTesRewards>? rewards = (json['rewards'] as List<
- dynamic>?)
- ?.map(
- (e) =>
- jsonConvert.convert<RewardsHomeTesRewards>(e) as RewardsHomeTesRewards)
- .toList();
- if (rewards != null) {
- rewardsHomeTesEntity.rewards = rewards;
- }
- return rewardsHomeTesEntity;
- }
- Map<String, dynamic> $RewardsHomeTesEntityToJson(RewardsHomeTesEntity entity) {
- final Map<String, dynamic> data = <String, dynamic>{};
- data['id'] = entity.id;
- data['name'] = entity.name;
- data['rewards'] = entity.rewards.map((v) => v.toJson()).toList();
- return data;
- }
- extension RewardsHomeTesEntityExtension on RewardsHomeTesEntity {
- RewardsHomeTesEntity copyWith({
- double? id,
- String? name,
- List<RewardsHomeTesRewards>? rewards,
- }) {
- return RewardsHomeTesEntity()
- ..id = id ?? this.id
- ..name = name ?? this.name
- ..rewards = rewards ?? this.rewards;
- }
- }
- RewardsHomeTesRewards $RewardsHomeTesRewardsFromJson(
- Map<String, dynamic> json) {
- final RewardsHomeTesRewards rewardsHomeTesRewards = RewardsHomeTesRewards();
- final double? id = jsonConvert.convert<double>(json['id']);
- if (id != null) {
- rewardsHomeTesRewards.id = id;
- }
- final String? name = jsonConvert.convert<String>(json['name']);
- if (name != null) {
- rewardsHomeTesRewards.name = name;
- }
- final List<String>? resources = (json['resources'] as List<dynamic>?)?.map(
- (e) => jsonConvert.convert<String>(e) as String).toList();
- if (resources != null) {
- rewardsHomeTesRewards.resources = resources;
- }
- final double? originalPoint = jsonConvert.convert<double>(
- json['original_point']);
- if (originalPoint != null) {
- rewardsHomeTesRewards.originalPoint = originalPoint;
- }
- final double? point = jsonConvert.convert<double>(json['point']);
- if (point != null) {
- rewardsHomeTesRewards.point = point;
- }
- return rewardsHomeTesRewards;
- }
- Map<String, dynamic> $RewardsHomeTesRewardsToJson(
- RewardsHomeTesRewards 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 RewardsHomeTesRewardsExtension on RewardsHomeTesRewards {
- RewardsHomeTesRewards copyWith({
- double? id,
- String? name,
- List<String>? resources,
- double? originalPoint,
- double? point,
- }) {
- return RewardsHomeTesRewards()
- ..id = id ?? this.id
- ..name = name ?? this.name
- ..resources = resources ?? this.resources
- ..originalPoint = originalPoint ?? this.originalPoint
- ..point = point ?? this.point;
- }
- }
|