ContentModel.fromJson constructor

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

Implementation

factory ContentModel.fromJson(Map<String, dynamic> json) {
  return ContentModel(
    author: json['author'] ?? '',
    permlink: json['permlink'] ?? '',
    title: json['title'] ?? '',
    body: json['body'] ?? '',
    bodyLength: json['body_length'] ?? 0,
    category: json['category'] ?? '',
    created: json['created'] ?? '',
    lastUpdate: json['last_update'] ?? '',
    url: json['url'] ?? '',
    jsonMetadata: json['json_metadata'] ?? '',
    children: json['children'] ?? 0,
    netVotes: json['net_votes'] ?? 0,
    depth: json['depth'] ?? 0,
    activeVotes: (json['active_votes'] as List<dynamic>?)
            ?.map((e) => ActiveContentVote.fromJson(e))
            .toList() ??
        [],
    beneficiaries: (json['beneficiaries'] as List<dynamic>?)
            ?.map((e) => BeneficiaryContent.fromJson(e))
            .toList() ??
        [],
    payOutValue: json['pending_payout_value'] ?? '',
  );
}