ArticleDetail.from constructor

ArticleDetail.from(
  1. Map<String, dynamic> data
)

Implementation

ArticleDetail.from(Map<String, dynamic> data)
    : showInList = (data['articleShowInList'] ?? 0) == 1,
      createTime = data['articleCreateTime'] ?? '',
      authorId = data['articleAuthorId'] ?? '',
      badCnt = data['articleBadCnt'] ?? 0,
      latestCmtTime = data['articleLatestCmtTime'] ?? '',
      goodCnt = data['articleGoodCnt'] ?? 0,
      offerPoint = data['articleQnAOfferPoint'] ?? 0,
      thumbnailURL = data['articleThumbnailURL'] ?? '',
      stickRemains = data['articleStickRemains'] ?? 0,
      timeAgo = data['timeAgo'] ?? '',
      updateTimeStr = data['articleUpdateTimeStr'] ?? '',
      authorName = data['articleAuthorName'] ?? '',
      type = ArticleType.values[data['articleType'] ?? 0],
      offered = data['offered'] ?? false,
      createTimeStr = data['articleCreateTimeStr'] ?? '',
      viewCnt = data['articleViewCount'] ?? 0,
      thumbnailURL20 = data['articleAuthorThumbnailURL20'] ?? '',
      watchCnt = data['articleWatchCnt'] ?? 0,
      previewContent = data['articlePreviewContent'] ?? '',
      titleEmoj = data['articleTitleEmoj'] ?? '',
      titleEmojUnicode = data['articleTitleEmojUnicode'] ?? '',
      title = data['articleTitle'] ?? '',
      thumbnailURL48 = data['articleAuthorThumbnailURL48'] ?? '',
      commentCnt = data['articleCommentCount'] ?? 0,
      collectCnt = data['articleCollectCnt'] ?? 0,
      latestCmterName = data['articleLatestCmterName'] ?? '',
      tags = data['articleTags'] ?? '',
      oId = data['oId'] ?? '',
      cmtTimeAgo = data['cmtTimeAgo'] ?? '',
      stick = data['articleStick'] ?? 0,
      tagObjs = List.from(data['articleTagObjs'] ?? [])
          .map((e) => ArticleTag.from(e))
          .toList(),
      latestCmtTimeStr = data['articleLatestCmtTimeStr'] ?? '',
      anonymous = (data['articleAnonymous'] ?? 0) == 1,
      thankCnt = data['articleThankCnt'] ?? 0,
      updateTime = data['articleUpdateTime'] ?? '',
      status = ArticleStatus.values[data['articleStatus'] ?? 0],
      heat = data['articleHeat'] ?? 0,
      perfect = (data['articlePerfect'] ?? 0) == 1,
      thumbnailURL210 = data['articleAuthorThumbnailURL210'] ?? '',
      permalink = data['articlePermalink'] ?? '',
      author = ArticleAuthor.from(data['articleAuthor'] ?? {}),
      thankedCnt = data['thankedCnt'] ?? 0,
      anonymousView = data['articleAnonymousView'] ?? 0,
      viewCntFormat = data['articleViewCntDisplayFormat'] ?? '',
      commentable = data['articleCommentable'] ?? false,
      rewarded = data['rewarded'] ?? false,
      rewardedCnt = data['rewardedCnt'] ?? 0,
      rewardPoint = data['articleRewardPoint'] ?? 0,
      isFollowing = data['isFollowing'] ?? false,
      isWatching = data['isWatching'] ?? false,
      isMyArticle = data['isMyArticle'] ?? false,
      thanked = data['thanked'] ?? false,
      editorType = data['articleEditorType'] ?? 0,
      audioURL = data['articleAudioURL'] ?? '',
      table = data['articleToC'] ?? '',
      content = data['articleContent'] ?? '',
      source = data['articleOriginalContent'] ?? '',
      img1URL = data['articleImg1URL'] ?? '',
      vote = VoteStatus.values[(data['articleVote'] ?? 0) + 1],
      randomDouble = data['articleRandomDouble'] ?? 0.0,
      authorIntro = data['articleAuthorIntro'] ?? '',
      city = data['articleCity'] ?? '',
      IP = data['articleIP'] ?? '',
      authorURL = data['articleAuthorURL'] ?? '',
      pushOrder = data['articlePushOrder'] ?? 0,
      rewardContent = data['articleRewardContent'] ?? '',
      redditScore = (data['redditScore'] ?? 0).toString(),
      pagination = data['pagination'] != null
          ? Pagination.from(data['pagination'])
          : null,
      commentViewable = data['discussionViewable'] ?? false,
      revisionCount = data['articleRevisionCount'] ?? 0,
      comments = List.from(data['articleComments'] ?? [])
          .map((e) => ArticleComment.from(e))
          .toList(),
      niceComments = List.from(data['articleNiceComments'] ?? [])
          .map((e) => ArticleComment.from(e))
          .toList();