mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: data parse
related #258 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -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'];
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user