123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173 |
- import 'package:domain/generated/json/base/json_convert_content.dart';
- import 'package:domain/entity/garage_sale_rent_entity.dart';
- GarageSaleRentEntity $GarageSaleRentEntityFromJson(Map<String, dynamic> json) {
- final GarageSaleRentEntity garageSaleRentEntity = GarageSaleRentEntity();
- final int? count = jsonConvert.convert<int>(json['count']);
- if (count != null) {
- garageSaleRentEntity.count = count;
- }
- final int? page = jsonConvert.convert<int>(json['page']);
- if (page != null) {
- garageSaleRentEntity.page = page;
- }
- final int? limit = jsonConvert.convert<int>(json['limit']);
- if (limit != null) {
- garageSaleRentEntity.limit = limit;
- }
- final int? countPage = jsonConvert.convert<int>(json['count_page']);
- if (countPage != null) {
- garageSaleRentEntity.countPage = countPage;
- }
- final List<GarageSaleRentList>? list = (json['list'] as List<dynamic>?)
- ?.map(
- (e) =>
- jsonConvert.convert<GarageSaleRentList>(e) as GarageSaleRentList)
- .toList();
- if (list != null) {
- garageSaleRentEntity.list = list;
- }
- return garageSaleRentEntity;
- }
- Map<String, dynamic> $GarageSaleRentEntityToJson(GarageSaleRentEntity 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 GarageSaleRentEntityExtension on GarageSaleRentEntity {
- GarageSaleRentEntity copyWith({
- int? count,
- int? page,
- int? limit,
- int? countPage,
- List<GarageSaleRentList>? list,
- }) {
- return GarageSaleRentEntity()
- ..count = count ?? this.count
- ..page = page ?? this.page
- ..limit = limit ?? this.limit
- ..countPage = countPage ?? this.countPage
- ..list = list ?? this.list;
- }
- }
- GarageSaleRentList $GarageSaleRentListFromJson(Map<String, dynamic> json) {
- final GarageSaleRentList garageSaleRentList = GarageSaleRentList();
- final int? id = jsonConvert.convert<int>(json['id']);
- if (id != null) {
- garageSaleRentList.id = id;
- }
- final String? title = jsonConvert.convert<String>(json['title']);
- if (title != null) {
- garageSaleRentList.title = title;
- }
- final int? price = jsonConvert.convert<int>(json['price']);
- if (price != null) {
- garageSaleRentList.price = price;
- }
- final List<String>? resources = (json['resources'] as List<dynamic>?)?.map(
- (e) => jsonConvert.convert<String>(e) as String).toList();
- if (resources != null) {
- garageSaleRentList.resources = resources;
- }
- final String? createdAt = jsonConvert.convert<String>(json['created_at']);
- if (createdAt != null) {
- garageSaleRentList.createdAt = createdAt;
- }
- final bool? liked = jsonConvert.convert<bool>(json['liked']);
- if (liked != null) {
- garageSaleRentList.liked = liked;
- }
- final int? likesCount = jsonConvert.convert<int>(json['likes_count']);
- if (likesCount != null) {
- garageSaleRentList.likesCount = likesCount;
- }
- final GarageSaleRentListAccount? account = jsonConvert.convert<
- GarageSaleRentListAccount>(json['account']);
- if (account != null) {
- garageSaleRentList.account = account;
- }
- return garageSaleRentList;
- }
- Map<String, dynamic> $GarageSaleRentListToJson(GarageSaleRentList entity) {
- final Map<String, dynamic> data = <String, dynamic>{};
- data['id'] = entity.id;
- data['title'] = entity.title;
- data['price'] = entity.price;
- data['resources'] = entity.resources;
- data['created_at'] = entity.createdAt;
- data['liked'] = entity.liked;
- data['likes_count'] = entity.likesCount;
- data['account'] = entity.account?.toJson();
- return data;
- }
- extension GarageSaleRentListExtension on GarageSaleRentList {
- GarageSaleRentList copyWith({
- int? id,
- String? title,
- int? price,
- List<String>? resources,
- String? createdAt,
- bool? liked,
- int? likesCount,
- GarageSaleRentListAccount? account,
- }) {
- return GarageSaleRentList()
- ..id = id ?? this.id
- ..title = title ?? this.title
- ..price = price ?? this.price
- ..resources = resources ?? this.resources
- ..createdAt = createdAt ?? this.createdAt
- ..liked = liked ?? this.liked
- ..likesCount = likesCount ?? this.likesCount
- ..account = account ?? this.account;
- }
- }
- GarageSaleRentListAccount $GarageSaleRentListAccountFromJson(
- Map<String, dynamic> json) {
- final GarageSaleRentListAccount garageSaleRentListAccount = GarageSaleRentListAccount();
- final int? id = jsonConvert.convert<int>(json['id']);
- if (id != null) {
- garageSaleRentListAccount.id = id;
- }
- final String? name = jsonConvert.convert<String>(json['name']);
- if (name != null) {
- garageSaleRentListAccount.name = name;
- }
- final String? avatar = jsonConvert.convert<String>(json['avatar']);
- if (avatar != null) {
- garageSaleRentListAccount.avatar = avatar;
- }
- return garageSaleRentListAccount;
- }
- Map<String, dynamic> $GarageSaleRentListAccountToJson(
- GarageSaleRentListAccount entity) {
- final Map<String, dynamic> data = <String, dynamic>{};
- data['id'] = entity.id;
- data['name'] = entity.name;
- data['avatar'] = entity.avatar;
- return data;
- }
- extension GarageSaleRentListAccountExtension on GarageSaleRentListAccount {
- GarageSaleRentListAccount copyWith({
- int? id,
- String? name,
- String? avatar,
- }) {
- return GarageSaleRentListAccount()
- ..id = id ?? this.id
- ..name = name ?? this.name
- ..avatar = avatar ?? this.avatar;
- }
- }
|