Post.fromJson constructor

Post.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory Post.fromJson(Map<String, dynamic> json) {
  return Post(
    postID: json['postID'],
    content: json['content'],
    postDate: json['postDate'],
    postDateCountdown: json['postDateCountdown'],
    sharedDevice: json['sharedDevice'],
    likesCount: json['likesCount'],
    commentsCount: json['commentsCount'],
    isLikeme: json['isLikeme'],
    iscommentMe: json['iscommentMe'],
    owner: User.fromJson(json['owner']),
    media: (json['media'] as List).map((m) => Media.fromJson(m)).toList(),
    firstthreecomment: json['firstthreecomment'] != null
        ? (json['firstthreecomment'] as List)
            .map((c) => Comment.fromJson(c))
            .toList()
            .obs
        : null,
    comments: json['comments'] != null
        ? (json['comments'] as List)
            .map((c) => Comment.fromJson(c))
            .toList()
            .obs
        : null,
    firstthreelike: json['firstthreelike'] != null
        ? (json['firstthreelike'] as List)
            .map((l) => Like.fromJson(l))
            .toList()
            .obs
        : null,
    likers: json['likers'] != null
        ? (json['likers'] as List).map((l) => Like.fromJson(l)).toList().obs
        : null,
    location: json['location'],
  );
}