123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183 |
- import 'package:domain/generated/json/base/json_convert_content.dart';
- import 'package:domain/entity/repair_service_entity.dart';
- RepairServiceEntity $RepairServiceEntityFromJson(Map<String, dynamic> json) {
- final RepairServiceEntity repairServiceEntity = RepairServiceEntity();
- final int? count = jsonConvert.convert<int>(json['count']);
- if (count != null) {
- repairServiceEntity.count = count;
- }
- final int? page = jsonConvert.convert<int>(json['page']);
- if (page != null) {
- repairServiceEntity.page = page;
- }
- final int? limit = jsonConvert.convert<int>(json['limit']);
- if (limit != null) {
- repairServiceEntity.limit = limit;
- }
- final int? countPage = jsonConvert.convert<int>(json['count_page']);
- if (countPage != null) {
- repairServiceEntity.countPage = countPage;
- }
- final List<RepairServiceList>? list = (json['list'] as List<dynamic>?)?.map(
- (e) => jsonConvert.convert<RepairServiceList>(e) as RepairServiceList).toList();
- if (list != null) {
- repairServiceEntity.list = list;
- }
- return repairServiceEntity;
- }
- Map<String, dynamic> $RepairServiceEntityToJson(RepairServiceEntity 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 RepairServiceEntityExtension on RepairServiceEntity {
- RepairServiceEntity copyWith({
- int? count,
- int? page,
- int? limit,
- int? countPage,
- List<RepairServiceList>? list,
- }) {
- return RepairServiceEntity()
- ..count = count ?? this.count
- ..page = page ?? this.page
- ..limit = limit ?? this.limit
- ..countPage = countPage ?? this.countPage
- ..list = list ?? this.list;
- }
- }
- RepairServiceList $RepairServiceListFromJson(Map<String, dynamic> json) {
- final RepairServiceList repairServiceList = RepairServiceList();
- final int? id = jsonConvert.convert<int>(json['id']);
- if (id != null) {
- repairServiceList.id = id;
- }
- final String? name = jsonConvert.convert<String>(json['name']);
- if (name != null) {
- repairServiceList.name = name;
- }
- final int? likesCount = jsonConvert.convert<int>(json['likes_count']);
- if (likesCount != null) {
- repairServiceList.likesCount = likesCount;
- }
- final bool? liked = jsonConvert.convert<bool>(json['liked']);
- if (liked != null) {
- repairServiceList.liked = liked;
- }
- final RepairServiceListMerchant? merchant = jsonConvert.convert<RepairServiceListMerchant>(json['merchant']);
- if (merchant != null) {
- repairServiceList.merchant = merchant;
- }
- final RepairServiceListCategory? category = jsonConvert.convert<RepairServiceListCategory>(json['category']);
- if (category != null) {
- repairServiceList.category = category;
- }
- return repairServiceList;
- }
- Map<String, dynamic> $RepairServiceListToJson(RepairServiceList entity) {
- final Map<String, dynamic> data = <String, dynamic>{};
- data['id'] = entity.id;
- data['name'] = entity.name;
- data['likes_count'] = entity.likesCount;
- data['liked'] = entity.liked;
- data['merchant'] = entity.merchant?.toJson();
- data['category'] = entity.category?.toJson();
- return data;
- }
- extension RepairServiceListExtension on RepairServiceList {
- RepairServiceList copyWith({
- int? id,
- String? name,
- int? likesCount,
- bool? liked,
- RepairServiceListMerchant? merchant,
- RepairServiceListCategory? category,
- }) {
- return RepairServiceList()
- ..id = id ?? this.id
- ..name = name ?? this.name
- ..likesCount = likesCount ?? this.likesCount
- ..liked = liked ?? this.liked
- ..merchant = merchant ?? this.merchant
- ..category = category ?? this.category;
- }
- }
- RepairServiceListMerchant $RepairServiceListMerchantFromJson(Map<String, dynamic> json) {
- final RepairServiceListMerchant repairServiceListMerchant = RepairServiceListMerchant();
- final int? id = jsonConvert.convert<int>(json['id']);
- if (id != null) {
- repairServiceListMerchant.id = id;
- }
- final String? name = jsonConvert.convert<String>(json['name']);
- if (name != null) {
- repairServiceListMerchant.name = name;
- }
- return repairServiceListMerchant;
- }
- Map<String, dynamic> $RepairServiceListMerchantToJson(RepairServiceListMerchant entity) {
- final Map<String, dynamic> data = <String, dynamic>{};
- data['id'] = entity.id;
- data['name'] = entity.name;
- return data;
- }
- extension RepairServiceListMerchantExtension on RepairServiceListMerchant {
- RepairServiceListMerchant copyWith({
- int? id,
- String? name,
- }) {
- return RepairServiceListMerchant()
- ..id = id ?? this.id
- ..name = name ?? this.name;
- }
- }
- RepairServiceListCategory $RepairServiceListCategoryFromJson(Map<String, dynamic> json) {
- final RepairServiceListCategory repairServiceListCategory = RepairServiceListCategory();
- final int? id = jsonConvert.convert<int>(json['id']);
- if (id != null) {
- repairServiceListCategory.id = id;
- }
- final String? name = jsonConvert.convert<String>(json['name']);
- if (name != null) {
- repairServiceListCategory.name = name;
- }
- final String? type = jsonConvert.convert<String>(json['type']);
- if (type != null) {
- repairServiceListCategory.type = type;
- }
- return repairServiceListCategory;
- }
- Map<String, dynamic> $RepairServiceListCategoryToJson(RepairServiceListCategory entity) {
- final Map<String, dynamic> data = <String, dynamic>{};
- data['id'] = entity.id;
- data['name'] = entity.name;
- data['type'] = entity.type;
- return data;
- }
- extension RepairServiceListCategoryExtension on RepairServiceListCategory {
- RepairServiceListCategory copyWith({
- int? id,
- String? name,
- String? type,
- }) {
- return RepairServiceListCategory()
- ..id = id ?? this.id
- ..name = name ?? this.name
- ..type = type ?? this.type;
- }
- }
|