12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- import 'package:domain/generated/json/base/json_convert_content.dart';
- import 'package:domain/entity/property_news_detail_entity.dart';
- PropertyNewsDetailEntity $PropertyNewsDetailEntityFromJson(
- Map<String, dynamic> json) {
- final PropertyNewsDetailEntity propertyNewsDetailEntity = PropertyNewsDetailEntity();
- final int? id = jsonConvert.convert<int>(json['id']);
- if (id != null) {
- propertyNewsDetailEntity.id = id;
- }
- final String? title = jsonConvert.convert<String>(json['title']);
- if (title != null) {
- propertyNewsDetailEntity.title = title;
- }
- final String? coverImage = jsonConvert.convert<String>(json['cover_image']);
- if (coverImage != null) {
- propertyNewsDetailEntity.coverImage = coverImage;
- }
- final String? content = jsonConvert.convert<String>(json['content']);
- if (content != null) {
- propertyNewsDetailEntity.content = content;
- }
- final String? createdAt = jsonConvert.convert<String>(json['created_at']);
- if (createdAt != null) {
- propertyNewsDetailEntity.createdAt = createdAt;
- }
- final int? likesCount = jsonConvert.convert<int>(json['likes_count']);
- if (likesCount != null) {
- propertyNewsDetailEntity.likesCount = likesCount;
- }
- final bool? liked = jsonConvert.convert<bool>(json['liked']);
- if (liked != null) {
- propertyNewsDetailEntity.liked = liked;
- }
- return propertyNewsDetailEntity;
- }
- Map<String, dynamic> $PropertyNewsDetailEntityToJson(
- PropertyNewsDetailEntity entity) {
- final Map<String, dynamic> data = <String, dynamic>{};
- data['id'] = entity.id;
- data['title'] = entity.title;
- data['cover_image'] = entity.coverImage;
- data['content'] = entity.content;
- data['created_at'] = entity.createdAt;
- data['likes_count'] = entity.likesCount;
- data['liked'] = entity.liked;
- return data;
- }
- extension PropertyNewsDetailEntityExtension on PropertyNewsDetailEntity {
- PropertyNewsDetailEntity copyWith({
- int? id,
- String? title,
- String? coverImage,
- String? content,
- String? createdAt,
- int? likesCount,
- bool? liked,
- }) {
- return PropertyNewsDetailEntity()
- ..id = id ?? this.id
- ..title = title ?? this.title
- ..coverImage = coverImage ?? this.coverImage
- ..content = content ?? this.content
- ..createdAt = createdAt ?? this.createdAt
- ..likesCount = likesCount ?? this.likesCount
- ..liked = liked ?? this.liked;
- }
- }
|