import 'package:domain/generated/json/base/json_convert_content.dart'; import 'package:domain/entity/latest_news_page_entity.dart'; LatestNewsPageEntity $LatestNewsPageEntityFromJson(Map json) { final LatestNewsPageEntity latestNewsPageEntity = LatestNewsPageEntity(); final int? count = jsonConvert.convert(json['count']); if (count != null) { latestNewsPageEntity.count = count; } final int? page = jsonConvert.convert(json['page']); if (page != null) { latestNewsPageEntity.page = page; } final int? limit = jsonConvert.convert(json['limit']); if (limit != null) { latestNewsPageEntity.limit = limit; } final int? countPage = jsonConvert.convert(json['count_page']); if (countPage != null) { latestNewsPageEntity.countPage = countPage; } final List? list = (json['list'] as List?)?.map( (e) => jsonConvert.convert(e) as LatestNewsList).toList(); if (list != null) { latestNewsPageEntity.list = list; } return latestNewsPageEntity; } Map $LatestNewsPageEntityToJson(LatestNewsPageEntity entity) { final Map data = {}; 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 LatestNewsPageEntityExtension on LatestNewsPageEntity { LatestNewsPageEntity copyWith({ int? count, int? page, int? limit, int? countPage, List? list, }) { return LatestNewsPageEntity() ..count = count ?? this.count ..page = page ?? this.page ..limit = limit ?? this.limit ..countPage = countPage ?? this.countPage ..list = list ?? this.list; } } LatestNewsList $LatestNewsListFromJson(Map json) { final LatestNewsList latestNewsList = LatestNewsList(); final String? id = jsonConvert.convert(json['id']); if (id != null) { latestNewsList.id = id; } final int? type = jsonConvert.convert(json['type']); if (type != null) { latestNewsList.type = type; } final String? title = jsonConvert.convert(json['title']); if (title != null) { latestNewsList.title = title; } final String? coverImage = jsonConvert.convert(json['cover_image']); if (coverImage != null) { latestNewsList.coverImage = coverImage; } final String? content = jsonConvert.convert(json['content']); if (content != null) { latestNewsList.content = content; } final String? createdAt = jsonConvert.convert(json['created_at']); if (createdAt != null) { latestNewsList.createdAt = createdAt; } return latestNewsList; } Map $LatestNewsListToJson(LatestNewsList entity) { final Map data = {}; data['id'] = entity.id; data['type'] = entity.type; data['title'] = entity.title; data['cover_image'] = entity.coverImage; data['content'] = entity.content; data['created_at'] = entity.createdAt; return data; } extension LatestNewsListExtension on LatestNewsList { LatestNewsList copyWith({ String? id, int? type, String? title, String? coverImage, String? content, String? createdAt, }) { return LatestNewsList() ..id = id ?? this.id ..type = type ?? this.type ..title = title ?? this.title ..coverImage = coverImage ?? this.coverImage ..content = content ?? this.content ..createdAt = createdAt ?? this.createdAt; } }