12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- 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;
- }
- }
|