123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206 |
- import 'package:domain/generated/json/base/json_convert_content.dart';
- import 'package:domain/entity/paid_service_entity.dart';
- PaidServiceEntity $PaidServiceEntityFromJson(Map<String, dynamic> json) {
- final PaidServiceEntity paidServiceEntity = PaidServiceEntity();
- final int? count = jsonConvert.convert<int>(json['count']);
- if (count != null) {
- paidServiceEntity.count = count;
- }
- final int? page = jsonConvert.convert<int>(json['page']);
- if (page != null) {
- paidServiceEntity.page = page;
- }
- final int? limit = jsonConvert.convert<int>(json['limit']);
- if (limit != null) {
- paidServiceEntity.limit = limit;
- }
- final int? countPage = jsonConvert.convert<int>(json['count_page']);
- if (countPage != null) {
- paidServiceEntity.countPage = countPage;
- }
- final List<PaidServiceList>? list = (json['list'] as List<dynamic>?)
- ?.map(
- (e) => jsonConvert.convert<PaidServiceList>(e) as PaidServiceList)
- .toList();
- if (list != null) {
- paidServiceEntity.list = list;
- }
- return paidServiceEntity;
- }
- Map<String, dynamic> $PaidServiceEntityToJson(PaidServiceEntity entity) {
- final Map<String, dynamic> data = <String, dynamic>{};
- data['count'] = entity.count;
- data['page'] = entity.page;
- data['limit'] = entity.limit;
- data['count_page'] = entity.countPage;
- data['list'] = entity.list?.map((v) => v.toJson()).toList();
- return data;
- }
- extension PaidServiceEntityExtension on PaidServiceEntity {
- PaidServiceEntity copyWith({
- int? count,
- int? page,
- int? limit,
- int? countPage,
- List<PaidServiceList>? list,
- }) {
- return PaidServiceEntity()
- ..count = count ?? this.count
- ..page = page ?? this.page
- ..limit = limit ?? this.limit
- ..countPage = countPage ?? this.countPage
- ..list = list ?? this.list;
- }
- }
- PaidServiceList $PaidServiceListFromJson(Map<String, dynamic> json) {
- final PaidServiceList paidServiceList = PaidServiceList();
- final int? id = jsonConvert.convert<int>(json['id']);
- if (id != null) {
- paidServiceList.id = id;
- }
- final String? name = jsonConvert.convert<String>(json['name']);
- if (name != null) {
- paidServiceList.name = name;
- }
- final List<String>? resources = (json['resources'] as List<dynamic>?)?.map(
- (e) => jsonConvert.convert<String>(e) as String).toList();
- if (resources != null) {
- paidServiceList.resources = resources;
- }
- final int? lowestPrice = jsonConvert.convert<int>(json['lowest_price']);
- if (lowestPrice != null) {
- paidServiceList.lowestPrice = lowestPrice;
- }
- final int? likesCount = jsonConvert.convert<int>(json['likes_count']);
- if (likesCount != null) {
- paidServiceList.likesCount = likesCount;
- }
- final bool? liked = jsonConvert.convert<bool>(json['liked']);
- if (liked != null) {
- paidServiceList.liked = liked;
- }
- final PaidServiceListMerchant? merchant = jsonConvert.convert<
- PaidServiceListMerchant>(json['merchant']);
- if (merchant != null) {
- paidServiceList.merchant = merchant;
- }
- final PaidServiceListCategory? category = jsonConvert.convert<
- PaidServiceListCategory>(json['category']);
- if (category != null) {
- paidServiceList.category = category;
- }
- return paidServiceList;
- }
- Map<String, dynamic> $PaidServiceListToJson(PaidServiceList entity) {
- final Map<String, dynamic> data = <String, dynamic>{};
- data['id'] = entity.id;
- data['name'] = entity.name;
- data['resources'] = entity.resources;
- data['lowest_price'] = entity.lowestPrice;
- data['likes_count'] = entity.likesCount;
- data['liked'] = entity.liked;
- data['merchant'] = entity.merchant?.toJson();
- data['category'] = entity.category?.toJson();
- return data;
- }
- extension PaidServiceListExtension on PaidServiceList {
- PaidServiceList copyWith({
- int? id,
- String? name,
- List<String>? resources,
- int? lowestPrice,
- int? likesCount,
- bool? liked,
- PaidServiceListMerchant? merchant,
- PaidServiceListCategory? category,
- }) {
- return PaidServiceList()
- ..id = id ?? this.id
- ..name = name ?? this.name
- ..resources = resources ?? this.resources
- ..lowestPrice = lowestPrice ?? this.lowestPrice
- ..likesCount = likesCount ?? this.likesCount
- ..liked = liked ?? this.liked
- ..merchant = merchant ?? this.merchant
- ..category = category ?? this.category;
- }
- }
- PaidServiceListMerchant $PaidServiceListMerchantFromJson(
- Map<String, dynamic> json) {
- final PaidServiceListMerchant paidServiceListMerchant = PaidServiceListMerchant();
- final int? id = jsonConvert.convert<int>(json['id']);
- if (id != null) {
- paidServiceListMerchant.id = id;
- }
- final String? name = jsonConvert.convert<String>(json['name']);
- if (name != null) {
- paidServiceListMerchant.name = name;
- }
- return paidServiceListMerchant;
- }
- Map<String, dynamic> $PaidServiceListMerchantToJson(
- PaidServiceListMerchant entity) {
- final Map<String, dynamic> data = <String, dynamic>{};
- data['id'] = entity.id;
- data['name'] = entity.name;
- return data;
- }
- extension PaidServiceListMerchantExtension on PaidServiceListMerchant {
- PaidServiceListMerchant copyWith({
- int? id,
- String? name,
- }) {
- return PaidServiceListMerchant()
- ..id = id ?? this.id
- ..name = name ?? this.name;
- }
- }
- PaidServiceListCategory $PaidServiceListCategoryFromJson(
- Map<String, dynamic> json) {
- final PaidServiceListCategory paidServiceListCategory = PaidServiceListCategory();
- final int? id = jsonConvert.convert<int>(json['id']);
- if (id != null) {
- paidServiceListCategory.id = id;
- }
- final String? name = jsonConvert.convert<String>(json['name']);
- if (name != null) {
- paidServiceListCategory.name = name;
- }
- final String? type = jsonConvert.convert<String>(json['type']);
- if (type != null) {
- paidServiceListCategory.type = type;
- }
- return paidServiceListCategory;
- }
- Map<String, dynamic> $PaidServiceListCategoryToJson(
- PaidServiceListCategory entity) {
- final Map<String, dynamic> data = <String, dynamic>{};
- data['id'] = entity.id;
- data['name'] = entity.name;
- data['type'] = entity.type;
- return data;
- }
- extension PaidServiceListCategoryExtension on PaidServiceListCategory {
- PaidServiceListCategory copyWith({
- int? id,
- String? name,
- String? type,
- }) {
- return PaidServiceListCategory()
- ..id = id ?? this.id
- ..name = name ?? this.name
- ..type = type ?? this.type;
- }
- }
|