opt: data parse

related #258

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-02-15 11:36:07 +08:00
parent 47fbb6cd0e
commit 4b48aba2ae
27 changed files with 171 additions and 212 deletions

View File

@@ -15,11 +15,9 @@ class BangumiListDataModel {
BangumiListDataModel.fromJson(Map<String, dynamic> json) {
hasNext = json['has_next'];
list = json['list'] != null
? json['list']
.map<BangumiListItemModel>((e) => BangumiListItemModel.fromJson(e))
.toList()
: [];
list = (json['list'] as List?)
?.map<BangumiListItemModel>((e) => BangumiListItemModel.fromJson(e))
.toList();
num = json['num'];
size = json['size'];
total = json['total'];

View File

@@ -14,7 +14,7 @@ class DynamicsDataModel {
DynamicsDataModel.fromJson(Map<String, dynamic> json) {
hasMore = json['has_more'];
items = json['items']
items = (json['items'] as List?)
?.map<DynamicItemModel>((e) => DynamicItemModel.fromJson(e))
.toList();
offset = json['offset'];
@@ -364,7 +364,9 @@ class Good {
Good.fromJson(Map<String, dynamic> json) {
headIcon = json['head_icon'];
headText = json['head_text'];
items = json['items'].map<GoodItem>((e) => GoodItem.fromJson(e)).toList();
items = (json['items'] as List?)
?.map<GoodItem>((e) => GoodItem.fromJson(e))
.toList();
jumpUrl = json['jump_url'];
}
}
@@ -409,11 +411,9 @@ class DynamicDescModel {
String? text;
DynamicDescModel.fromJson(Map<String, dynamic> json) {
richTextNodes = json['rich_text_nodes'] != null
? json['rich_text_nodes']
.map<RichTextNodeItem>((e) => RichTextNodeItem.fromJson(e))
.toList()
: [];
richTextNodes = (json['rich_text_nodes'] as List?)
?.map<RichTextNodeItem>((e) => RichTextNodeItem.fromJson(e))
.toList();
text = json['text'];
}
}
@@ -557,12 +557,9 @@ class DynamicDrawModel {
DynamicDrawModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
// ignore: prefer_null_aware_operators
items = json['items'] != null
? json['items']
.map<DynamicDrawItemModel>((e) => DynamicDrawItemModel.fromJson(e))
.toList()
: null;
items = (json['items'] as List?)
?.map<DynamicDrawItemModel>((e) => DynamicDrawItemModel.fromJson(e))
.toList();
}
}
@@ -580,7 +577,7 @@ class DynamicOpusModel {
String? title;
DynamicOpusModel.fromJson(Map<String, dynamic> json) {
jumpUrl = json['jump_url'];
pics = json['pics']
pics = (json['pics'] as List?)
?.map<OpusPicsModel>((e) => OpusPicsModel.fromJson(e))
.toList();
summary =
@@ -599,8 +596,8 @@ class SummaryModel {
String? text;
SummaryModel.fromJson(Map<String, dynamic> json) {
richTextNodes = json['rich_text_nodes']
.map<RichTextNodeItem>((e) => RichTextNodeItem.fromJson(e))
richTextNodes = (json['rich_text_nodes'] as List?)
?.map<RichTextNodeItem>((e) => RichTextNodeItem.fromJson(e))
.toList();
text = json['text'];
}

View File

@@ -12,9 +12,9 @@ class FollowUpModel {
liveUsers = json['live_users'] != null
? LiveUsers.fromJson(json['live_users'])
: null;
upList = json['up_list'] != null
? json['up_list'].map<UpItem>((e) => UpItem.fromJson(e)).toList()
: [];
upList = (json['up_list'] as List?)
?.map<UpItem>((e) => UpItem.fromJson(e))
.toList();
}
}
@@ -32,8 +32,8 @@ class LiveUsers {
LiveUsers.fromJson(Map<String, dynamic> json) {
count = json['count'];
group = json['group'];
items = json['items']
.map<LiveUserItem>((e) => LiveUserItem.fromJson(e))
items = (json['items'] as List?)
?.map<LiveUserItem>((e) => LiveUserItem.fromJson(e))
.toList();
}
}

View File

@@ -9,8 +9,8 @@ class FansDataModel {
FansDataModel.fromJson(Map<String, dynamic> json) {
total = json['total'];
list = json['list']
.map<FansItemModel>((e) => FansItemModel.fromJson(e))
list = (json['list'] as List?)
?.map<FansItemModel>((e) => FansItemModel.fromJson(e))
.toList();
}
}

View File

@@ -9,8 +9,8 @@ class FollowDataModel {
FollowDataModel.fromJson(Map<String, dynamic> json) {
total = json['total'] ?? 0;
list = json['list']
.map<FollowItemModel>((e) => FollowItemModel.fromJson(e))
list = (json['list'] as List?)
?.map<FollowItemModel>((e) => FollowItemModel.fromJson(e))
.toList();
}
}

View File

@@ -17,9 +17,9 @@ class LatestDataModel {
url = json['url'];
tagName = json['tag_name'];
createdAt = json['created_at'];
assets = json['assets'] != null
? json['assets'].map<AssetItem>((e) => AssetItem.fromJson(e)).toList()
: [];
assets = (json['assets'] as List?)
?.map<AssetItem>((e) => AssetItem.fromJson(e))
.toList();
body = json['body'];
}
}

View File

@@ -45,9 +45,12 @@ class Playurl {
Playurl.fromJson(Map<String, dynamic> json) {
cid = json['cid'];
gQnDesc =
json['g_qn_desc'].map<GQnDesc>((e) => GQnDesc.fromJson(e)).toList();
stream = json['stream'].map<Streams>((e) => Streams.fromJson(e)).toList();
gQnDesc = (json['g_qn_desc'] as List?)
?.map<GQnDesc>((e) => GQnDesc.fromJson(e))
.toList();
stream = (json['stream'] as List?)
?.map<Streams>((e) => Streams.fromJson(e))
.toList();
}
}
@@ -83,8 +86,9 @@ class Streams {
Streams.fromJson(Map<String, dynamic> json) {
protocolName = json['protocol_name'];
format =
json['format'].map<FormatItem>((e) => FormatItem.fromJson(e)).toList();
format = (json['format'] as List?)
?.map<FormatItem>((e) => FormatItem.fromJson(e))
.toList();
}
}
@@ -99,7 +103,9 @@ class FormatItem {
FormatItem.fromJson(Map<String, dynamic> json) {
formatName = json['format_name'];
codec = json['codec'].map<CodecItem>((e) => CodecItem.fromJson(e)).toList();
codec = (json['codec'] as List?)
?.map<CodecItem>((e) => CodecItem.fromJson(e))
.toList();
}
}
@@ -129,8 +135,8 @@ class CodecItem {
currentQn = json['current_qn'];
acceptQn = json['accept_qn'];
baseUrl = json['base_url'];
urlInfo = json['url_info']
.map<UrlInfoItem>((e) => UrlInfoItem.fromJson(e))
urlInfo = (json['url_info'] as List?)
?.map<UrlInfoItem>((e) => UrlInfoItem.fromJson(e))
.toList();
hdrQn = json['hdr_n'];
dolbyType = json['dolby_type'];

View File

@@ -27,8 +27,8 @@ class ArchiveListModel {
? Map.from(json['tlist']).map((k, v) =>
MapEntry<String, TListItemModel>(k, TListItemModel.fromJson(v)))
: {};
vlist = json['vlist']
.map<VListItemModel>((e) => VListItemModel.fromJson(e))
vlist = (json['vlist'] as List?)
?.map<VListItemModel>((e) => VListItemModel.fromJson(e))
.toList();
}
}

View File

@@ -9,11 +9,9 @@ class MemberSeasonsDataModel {
MemberSeasonsDataModel.fromJson(Map<String, dynamic> json) {
page = json['page'];
seasonsList = json['seasons_list'] != null
? json['seasons_list']
.map<MemberSeasonsList>((e) => MemberSeasonsList.fromJson(e))
.toList()
: [];
seasonsList = (json['seasons_list'] as List?)
?.map<MemberSeasonsList>((e) => MemberSeasonsList.fromJson(e))
.toList();
}
}
@@ -31,11 +29,9 @@ class MemberSeasonsList {
Map? page;
MemberSeasonsList.fromJson(Map<String, dynamic> json) {
archives = json['archives'] != null
? json['archives']
.map<MemberArchiveItem>((e) => MemberArchiveItem.fromJson(e))
.toList()
: [];
archives = (json['archives'] as List?)
?.map<MemberArchiveItem>((e) => MemberArchiveItem.fromJson(e))
.toList();
meta = MamberMeta.fromJson(json['meta']);
page = json['page'];
}

View File

@@ -12,7 +12,7 @@ class SessionDataModel {
int? hasMore;
SessionDataModel.fromJson(Map<String, dynamic> json) {
sessionList = json['session_list']
sessionList = (json['session_list'] as List?)
?.map<SessionList>((e) => SessionList.fromJson(e))
.toList();
hasMore = json['has_more'];
@@ -175,8 +175,8 @@ class SessionMsgDataModel {
List<dynamic>? eInfos;
SessionMsgDataModel.fromJson(Map<String, dynamic> json) {
messages = json['messages']
.map<MessageItem>((e) => MessageItem.fromJson(e))
messages = (json['messages'] as List?)
?.map<MessageItem>((e) => MessageItem.fromJson(e))
.toList();
hasMore = json['has_more'];
minSeqno = json['min_seqno'];

View File

@@ -12,8 +12,8 @@ class HotSearchModel {
List<HotSearchItem>? list;
HotSearchModel.fromJson(Map<String, dynamic> json) {
list = json['list']
.map<HotSearchItem>((e) => HotSearchItem.fromJson(e))
list = (json['list'] as List?)
?.map<HotSearchItem>((e) => HotSearchItem.fromJson(e))
.toList();
}
}

View File

@@ -12,9 +12,9 @@ class SearchVideoModel {
SearchVideoModel.fromJson(Map<String, dynamic> json) {
numResults = (json['numResults'] as num?)?.toInt();
list = json['result']
list = (json['result'] as List?)
?.where((e) => e['available'] == true)
?.map<SearchVideoItemModel>((e) => SearchVideoItemModel.fromJson(e))
.map<SearchVideoItemModel>((e) => SearchVideoItemModel.fromJson(e))
.toList();
}
}
@@ -161,7 +161,7 @@ class SearchUserModel {
SearchUserModel.fromJson(Map<String, dynamic> json) {
numResults = (json['numResults'] as num?)?.toInt();
list = json['result']
list = (json['result'] as List?)
?.map<SearchUserItemModel>((e) => SearchUserItemModel.fromJson(e))
.toList();
}
@@ -316,12 +316,10 @@ class SearchMBangumiModel {
SearchMBangumiModel.fromJson(Map<String, dynamic> json) {
numResults = (json['numResults'] as num?)?.toInt();
list = json['result'] != null
? json['result']
.map<SearchMBangumiItemModel>(
(e) => SearchMBangumiItemModel.fromJson(e))
.toList()
: [];
list = (json['result'] as List?)
?.map<SearchMBangumiItemModel>(
(e) => SearchMBangumiItemModel.fromJson(e))
.toList();
}
}
@@ -420,12 +418,9 @@ class SearchArticleModel {
SearchArticleModel.fromJson(Map<String, dynamic> json) {
numResults = (json['numResults'] as num?)?.toInt();
list = json['result'] != null
? json['result']
.map<SearchArticleItemModel>(
(e) => SearchArticleItemModel.fromJson(e))
.toList()
: [];
list = (json['result'] as List?)
?.map<SearchArticleItemModel>((e) => SearchArticleItemModel.fromJson(e))
.toList();
}
}

View File

@@ -11,8 +11,8 @@ class SearchSuggestModel {
String? term;
SearchSuggestModel.fromJson(Map<String, dynamic> json) {
tag = json['tag']
.map<SearchSuggestItem>(
tag = (json['tag'] as List?)
?.map<SearchSuggestItem>(
(e) => SearchSuggestItem.fromJson(e, json['term']))
.toList();
}

View File

@@ -8,8 +8,8 @@ class BlackListDataModel {
int? total;
BlackListDataModel.fromJson(Map<String, dynamic> json) {
list = json['list']
.map<BlackListItem>((e) => BlackListItem.fromJson(e))
list = (json['list'] as List?)
?.map<BlackListItem>((e) => BlackListItem.fromJson(e))
.toList();
total = json['total'];
}

View File

@@ -15,11 +15,9 @@ class FavDetailData {
FavDetailData.fromJson(Map<String, dynamic> json) {
info =
json['info'] == null ? null : FavFolderItemData.fromJson(json['info']);
medias = json['medias'] != null
? json['medias']
.map<FavDetailItemData>((e) => FavDetailItemData.fromJson(e))
.toList()
: [];
medias = (json['medias'] as List?)
?.map<FavDetailItemData>((e) => FavDetailItemData.fromJson(e))
.toList();
hasMore = json['has_more'];
}
}

View File

@@ -11,11 +11,10 @@ class FavFolderData {
FavFolderData.fromJson(Map<String, dynamic> json) {
count = json['count'];
list = json['list'] != null
? json['list']
.map<FavFolderItemData>((e) => FavFolderItemData.fromJson(e))
.toList()
: [FavFolderItemData()];
list = (json['list'] as List?)
?.map<FavFolderItemData>((e) => FavFolderItemData.fromJson(e))
.toList() ??
[FavFolderItemData()];
hasMore = json['has_more'];
}
}

View File

@@ -13,12 +13,12 @@ class HistoryData {
HistoryData.fromJson(Map<String, dynamic> json) {
cursor = json['cursor'] != null ? Cursor.fromJson(json['cursor']) : null;
tab = json['tab'] != null
? json['tab'].map<HisTabItem>((e) => HisTabItem.fromJson(e)).toList()
: [];
list = json['list'] != null
? json['list'].map<HisListItem>((e) => HisListItem.fromJson(e)).toList()
: [];
tab = (json['tab'] as List?)
?.map<HisTabItem>((e) => HisTabItem.fromJson(e))
.toList();
list = (json['list'] as List?)
?.map<HisListItem>((e) => HisListItem.fromJson(e))
.toList();
page = json['page'];
}
}

View File

@@ -245,9 +245,7 @@ class EmoteMeta {
EmoteMeta.fromJson(Map<String, dynamic> json) {
size = json['size'];
suggest = json['suggest'] == null
? null
: List<String>.from(json['suggest'].map((x) => x));
suggest = json['suggest'];
alias = json['alias'];
gifUrl = json['gif_url'];
}

View File

@@ -10,11 +10,9 @@ class SubFolderModelData {
factory SubFolderModelData.fromJson(Map<String, dynamic> json) {
return SubFolderModelData(
count: json['count'],
list: json['list'] != null
? (json['list'] as List)
.map<SubFolderItemData>((i) => SubFolderItemData.fromJson(i))
.toList()
: null,
list: (json['list'] as List?)
?.map<SubFolderItemData>((i) => SubFolderItemData.fromJson(i))
.toList(),
);
}
}

View File

@@ -39,8 +39,8 @@ class ModelResult {
ModelResult.fromJson(Map<String, dynamic> json) {
resultType = json['result_type'];
summary = json['summary'];
outline = json['outline']
.map<OutlineItem>((e) => OutlineItem.fromJson(e))
outline = (json['outline'] as List?)
?.map<OutlineItem>((e) => OutlineItem.fromJson(e))
.toList();
}
}
@@ -56,8 +56,8 @@ class OutlineItem {
OutlineItem.fromJson(Map<String, dynamic> json) {
title = json['title'];
partOutline = json['part_outline']
.map<PartOutline>((e) => PartOutline.fromJson(e))
partOutline = (json['part_outline'] as List?)
?.map<PartOutline>((e) => PartOutline.fromJson(e))
.toList();
}
}

View File

@@ -84,10 +84,7 @@ class MediaVideoItemModel {
likeState: json["like_state"],
favState: json["fav_state"],
page: json["page"],
// json["pages"] 可能为null
pages: json["pages"] == null
? []
: List<Page>.from(json["pages"].map((x) => Page.fromJson(x))),
pages: (json["pages"] as List?)?.map((x) => Page.fromJson(x)).toList(),
title: json["title"],
type: json["type"],
upper: Upper.fromJson(json["upper"]),
@@ -149,7 +146,7 @@ class Page {
duration: json["duration"],
link: json["link"],
page: json["page"],
metas: List<Meta>.from(json["metas"].map((x) => Meta.fromJson(x))),
metas: (json["metas"] as List?)?.map((x) => Meta.fromJson(x)).toList(),
from: json["from"],
dimension: Dimension.fromJson(json["dimension"]),
);

View File

@@ -49,17 +49,16 @@ class PlayUrlModel {
timeLength = json['timelength'];
acceptFormat = json['accept_format'];
acceptDesc = json['accept_description'];
acceptQuality = json['accept_quality'].map<int>((e) => e as int).toList();
acceptQuality =
(json['accept_quality'] as List?)?.map<int>((e) => e as int).toList();
videoCodecid = json['video_codecid'];
seekParam = json['seek_param'];
seekType = json['seek_type'];
dash = json['dash'] != null ? Dash.fromJson(json['dash']) : null;
durl = json['durl']?.map<Durl>((e) => Durl.fromJson(e)).toList();
supportFormats = json['support_formats'] != null
? json['support_formats']
.map<FormatItem>((e) => FormatItem.fromJson(e))
.toList()
: [];
durl = (json['durl'] as List?)?.map<Durl>((e) => Durl.fromJson(e)).toList();
supportFormats = (json['support_formats'] as List?)
?.map<FormatItem>((e) => FormatItem.fromJson(e))
.toList();
lastPlayTime = json['last_play_time'];
lastPlayCid = json['last_play_cid'];
}
@@ -85,10 +84,12 @@ class Dash {
Dash.fromJson(Map<String, dynamic> json) {
duration = json['duration'];
minBufferTime = json['minBufferTime'];
video = json['video'].map<VideoItem>((e) => VideoItem.fromJson(e)).toList();
audio = json['audio'] != null
? json['audio'].map<AudioItem>((e) => AudioItem.fromJson(e)).toList()
: [];
video = (json['video'] as List?)
?.map<VideoItem>((e) => VideoItem.fromJson(e))
.toList();
audio = (json['audio'] as List?)
?.map<AudioItem>((e) => AudioItem.fromJson(e))
.toList();
dolby = json['dolby'] != null ? Dolby.fromJson(json['dolby']) : null;
flac = json['flac'] != null ? Flac.fromJson(json['flac']) : null;
}
@@ -288,9 +289,9 @@ class Dolby {
Dolby.fromJson(Map<String, dynamic> json) {
type = json['type'];
audio = json['audio'] != null
? json['audio'].map<AudioItem>((e) => AudioItem.fromJson(e)).toList()
: [];
audio = (json['audio'] as List?)
?.map<AudioItem>((e) => AudioItem.fromJson(e))
.toList();
}
}

View File

@@ -8,7 +8,6 @@ class ReplyContent {
this.pictures, // {}
this.vote,
this.richText,
this.isText,
this.topicsMeta,
});
@@ -20,27 +19,19 @@ class ReplyContent {
List? pictures;
Map? vote;
Map? richText;
bool? isText;
Map? topicsMeta;
ReplyContent.fromJson(Map<String, dynamic> json) {
message = json['message']
.replaceAll('&gt;', '>')
.replaceAll('&#34;', '"')
.replaceAll('&#39;', "'");
message = json['message'];
atNameToMid = json['at_name_to_mid'] ?? {};
members = json['members'] != null
? json['members']
.map<MemberItemModel>((e) => MemberItemModel.fromJson(e))
.toList()
: [];
members = (json['members'] as List?)
?.map<MemberItemModel>((e) => MemberItemModel.fromJson(e))
.toList();
emote = json['emote'] ?? {};
jumpUrl = json['jump_url'] ?? {};
pictures = json['pictures'] ?? [];
vote = json['vote'] ?? {};
richText = json['rich_text'] ?? {};
// 不包含@ 笔记 图片的时候,文字可折叠
isText = atNameToMid!.isEmpty && vote!.isEmpty && pictures!.isEmpty;
topicsMeta = json['topics_meta'] ?? {};
}
}

View File

@@ -27,15 +27,15 @@ class ReplyData {
json['cursor'] == null ? null : ReplyCursor.fromJson(json['cursor']);
config =
json['config'] == null ? null : ReplyConfig.fromJson(json['config']);
replies = json['replies'] != null
? List<ReplyItemModel>.from(json['replies'].map<ReplyItemModel>(
(item) => ReplyItemModel.fromJson(item, json['upper']['mid'])))
: <ReplyItemModel>[];
topReplies = json['top_replies'] != null
? List<ReplyItemModel>.from(json['top_replies'].map<ReplyItemModel>(
(item) => ReplyItemModel.fromJson(item, json['upper']['mid'],
isTopStatus: true)))
: <ReplyItemModel>[];
replies = (json['replies'] as List?)
?.map<ReplyItemModel>(
(item) => ReplyItemModel.fromJson(item, json['upper']['mid']))
.toList();
topReplies = (json['top_replies'] as List?)
?.map<ReplyItemModel>((item) => ReplyItemModel.fromJson(
item, json['upper']['mid'],
isTopStatus: true))
.toList();
upper = json['upper'] == null ? null : ReplyUpper.fromJson(json['upper']);
}
}
@@ -60,15 +60,15 @@ class ReplyReplyData {
ReplyReplyData.fromJson(Map<String, dynamic> json) {
page = ReplyPage.fromJson(json['page']);
config = ReplyConfig.fromJson(json['config']);
replies = json['replies'] != null
? List<ReplyItemModel>.from(json['replies'].map<ReplyItemModel>(
(item) => ReplyItemModel.fromJson(item, json['upper']['mid'])))
: <ReplyItemModel>[];
topReplies = json['top_replies'] != null
? List<ReplyItemModel>.from(json['top_replies'].map<ReplyItemModel>(
(item) => ReplyItemModel.fromJson(item, json['upper']['mid'],
isTopStatus: true)))
: <ReplyItemModel>[];
replies = (json['replies'] as List?)
?.map<ReplyItemModel>(
(item) => ReplyItemModel.fromJson(item, json['upper']['mid']))
.toList();
topReplies = (json['top_replies'] as List?)
?.map<ReplyItemModel>((item) => ReplyItemModel.fromJson(
item, json['upper']['mid'],
isTopStatus: true))
.toList();
upper = ReplyUpper.fromJson(json['upper']);
root = ReplyItemModel.fromJson(json['root'], json['upper']['mid']);
}

View File

@@ -6,7 +6,7 @@ class EmoteModelData {
EmoteModelData.fromJson(Map<String, dynamic> json) {
setting =
json['setting'] != null ? Setting.fromJson(json['setting']) : null;
json['setting'] != null ? Setting.fromJson(json['setting']) : null;
if (json['packages'] != null) {
packages = <Packages>[];
json['packages'].forEach((v) {
@@ -68,17 +68,17 @@ class Packages {
Packages(
{this.id,
this.text,
this.url,
this.mtime,
this.type,
this.attr,
this.meta,
this.emote,
this.flags,
this.label,
this.packageSubTitle,
this.refMid});
this.text,
this.url,
this.mtime,
this.type,
this.attr,
this.meta,
this.emote,
this.flags,
this.label,
this.packageSubTitle,
this.refMid});
Packages.fromJson(Map<String, dynamic> json) {
id = json['id'];
@@ -95,7 +95,7 @@ class Packages {
});
}
flags =
json['flags'] != null ? PackagesFlags.fromJson(json['flags']) : null;
json['flags'] != null ? PackagesFlags.fromJson(json['flags']) : null;
label = json['label'] != null ? Label.fromJson(json['label']) : null;
packageSubTitle = json['package_sub_title'];
refMid = json['ref_mid'];
@@ -189,16 +189,16 @@ class Emote {
Emote(
{this.id,
this.packageId,
this.text,
this.url,
this.mtime,
this.type,
this.attr,
this.meta,
this.flags,
this.activity,
this.gifUrl});
this.packageId,
this.text,
this.url,
this.mtime,
this.type,
this.attr,
this.meta,
this.flags,
this.activity,
this.gifUrl});
Emote.fromJson(Map<String, dynamic> json) {
id = json['id'];
@@ -245,9 +245,7 @@ class EmoteMeta {
EmoteMeta.fromJson(Map<String, dynamic> json) {
size = json['size'];
suggest = json['suggest'] == null
? null
: List<String>.from(json['suggest'].map((x) => x));
suggest = json['suggest'];
alias = json['alias'];
gifUrl = json['gif_url'];
}

View File

@@ -86,10 +86,9 @@ class ReplyItemModel {
action = json['action'];
member = ReplyMember.fromJson(json['member']);
content = ReplyContent.fromJson(json['content']);
replies = json['replies'] != null
? List<ReplyItemModel>.from(json['replies']
.map((item) => ReplyItemModel.fromJson(item, upperMid)))
: <ReplyItemModel>[];
replies = (json['replies'] as List?)
?.map((item) => ReplyItemModel.fromJson(item, upperMid))
.toList();
assist = json['assist'];
upAction = UpAction.fromJson(json['up_action']);
invisible = json['invisible'];
@@ -98,9 +97,8 @@ class ReplyItemModel {
: ReplyControl.fromJson(json['reply_control']);
isUp = upperMid.toString() == json['member']['mid'];
isTop = isTopStatus;
cardLabel = json['card_label'] != null
? json['card_label'].map((e) => e['text_content']).toList()
: [];
cardLabel =
(json['card_label'] as List?)?.map((e) => e['text_content']).toList();
rcount = json['rcount'];
}
}

View File

@@ -125,13 +125,11 @@ class VideoDetailData {
pubdate = json["pubdate"];
ctime = json["ctime"];
desc = json["desc"];
descV2 = json["desc_v2"] == null
? []
: List<DescV2>.from(json["desc_v2"]!.map((e) => DescV2.fromJson(e)));
descV2 =
(json["desc_v2"] as List?)?.map((e) => DescV2.fromJson(e)).toList();
state = json["state"];
duration = json["duration"];
rights =
Map.from(json["rights"]!).map((k, v) => MapEntry<String, int>(k, v));
rights = json["rights"];
owner = json["owner"] == null ? null : Owner.fromJson(json["owner"]);
stat = json["stat"] == null ? null : Stat.fromJson(json["stat"]);
argueMsg = json['argue_info']?['argue_msg'];
@@ -145,9 +143,7 @@ class VideoDetailData {
isChargeableSeason = json["is_chargeable_season"];
isStory = json["is_story"];
noCache = json["no_cache"];
pages = json["pages"] == null
? []
: List<Part>.from(json["pages"]!.map((e) => Part.fromJson(e)));
pages = (json["pages"] as List?)?.map((e) => Part.fromJson(e)).toList();
subtitle =
json["subtitle"] == null ? null : Subtitle.fromJson(json["subtitle"]);
ugcSeason = json["ugc_season"] != null
@@ -161,9 +157,8 @@ class VideoDetailData {
: HonorReply.fromJson(json["honor_reply"]);
likeIcon = json["like_icon"];
needJumpBv = json["need_jump_bv"];
staff = json["staff"] == null
? null
: (json["staff"] as List).map((item) => Staff.fromJson(item)).toList();
staff =
(json["staff"] as List?)?.map((item) => Staff.fromJson(item)).toList();
if (json['redirect_url'] != null) {
epId = resolveEpId(json['redirect_url']);
}
@@ -341,9 +336,7 @@ class HonorReply {
String toRawJson() => json.encode(toJson());
HonorReply.fromJson(Map<String, dynamic> json) {
honor = json["honor"] == null
? []
: List<Honor>.from(json["honor"]!.map((x) => Honor.fromJson(x)));
honor = (json["honor"] as List?)?.map((x) => Honor.fromJson(x)).toList();
}
Map<String, dynamic> toJson() {
@@ -563,9 +556,7 @@ class Subtitle {
Subtitle.fromJson(Map<String, dynamic> json) {
allowSubmit = json["allow_submit"];
list = json["list"] == null
? []
: List<dynamic>.from(json["list"]!.map((x) => x));
list = json["list"];
}
Map<String, dynamic> toJson() {
@@ -634,11 +625,9 @@ class UgcSeason {
intro = json['intro'];
signState = json['sign_state'];
attribute = json['attribute'];
sections = json['sections'] != null
? json['sections']
.map<SectionItem>((e) => SectionItem.fromJson(e))
.toList()
: [];
sections = (json['sections'] as List?)
?.map<SectionItem>((e) => SectionItem.fromJson(e))
.toList();
stat = Stat.fromJson(json['stat']);
epCount = json['ep_count'];
seasonType = json['season_type'];
@@ -680,8 +669,8 @@ class SectionItem {
id = json['id'];
title = json['title'];
type = json['type'];
episodes = json['episodes']
.map<EpisodeItem>((e) => EpisodeItem.fromJson(e))
episodes = (json['episodes'] as List?)
?.map<EpisodeItem>((e) => EpisodeItem.fromJson(e))
.toList();
}
}