fromJson static method

PeamanFeed fromJson(
  1. Map<String, dynamic> data
)

Implementation

static PeamanFeed fromJson(final Map<String, dynamic> data) {
  return PeamanFeed(
    id: data['id'],
    ownerId: data['owner_id'],
    type: PeamanFeedType.values[data['type'] ?? 0],
    caption: data['caption'] ?? '',
    files: List<PeamanFileUrl>.from(
      (data['files'] ?? []).map((e) => PeamanFileUrl.fromJson(e)).toList(),
    ),
    searchKeys: List<String>.from(data['search_keys'] ?? []),
    featured: data['featured'] ?? false,
    reactionsCount: data['reactions_count'] ?? 0,
    commentsCount: data['comments_count'] ?? 0,
    repliesCount: data['replies_count'] ?? 0,
    savesCount: data['saves_count'] ?? 0,
    sharesCount: data['shares_count'] ?? 0,
    viewsCount: data['views_count'] ?? 0,
    updatedAt: data['updated_at'],
    createdAt: data['created_at'],
    visibility: data['visibility'] ?? true,
    extraData: data,
  );
}