12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- import 'package:domain/generated/json/base/json_convert_content.dart';
- import 'package:domain/entity/myposts_sale_rent_entity.dart';
- MypostsSaleRentEntity $MypostsSaleRentEntityFromJson(
- Map<String, dynamic> json) {
- final MypostsSaleRentEntity mypostsSaleRentEntity = MypostsSaleRentEntity();
- final int? id = jsonConvert.convert<int>(json['id']);
- if (id != null) {
- mypostsSaleRentEntity.id = id;
- }
- final String? title = jsonConvert.convert<String>(json['title']);
- if (title != null) {
- mypostsSaleRentEntity.title = title;
- }
- final int? price = jsonConvert.convert<int>(json['price']);
- if (price != null) {
- mypostsSaleRentEntity.price = price;
- }
- final List<String>? resources = (json['resources'] as List<dynamic>?)?.map(
- (e) => jsonConvert.convert<String>(e) as String).toList();
- if (resources != null) {
- mypostsSaleRentEntity.resources = resources;
- }
- final String? createdAt = jsonConvert.convert<String>(json['created_at']);
- if (createdAt != null) {
- mypostsSaleRentEntity.createdAt = createdAt;
- }
- final int? likesCount = jsonConvert.convert<int>(json['likes_count']);
- if (likesCount != null) {
- mypostsSaleRentEntity.likesCount = likesCount;
- }
- return mypostsSaleRentEntity;
- }
- Map<String, dynamic> $MypostsSaleRentEntityToJson(
- MypostsSaleRentEntity 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['likes_count'] = entity.likesCount;
- return data;
- }
- extension MypostsSaleRentEntityExtension on MypostsSaleRentEntity {
- MypostsSaleRentEntity copyWith({
- int? id,
- String? title,
- int? price,
- List<String>? resources,
- String? createdAt,
- int? likesCount,
- }) {
- return MypostsSaleRentEntity()
- ..id = id ?? this.id
- ..title = title ?? this.title
- ..price = price ?? this.price
- ..resources = resources ?? this.resources
- ..createdAt = createdAt ?? this.createdAt
- ..likesCount = likesCount ?? this.likesCount;
- }
- }
|