fix: parse reply

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-04-12 20:53:59 +08:00
parent 2f34ae7d45
commit 15f84712cd
3 changed files with 15 additions and 8 deletions

View File

@@ -58,8 +58,9 @@ class ReplyReplyData {
ReplyItemModel? root; ReplyItemModel? root;
ReplyReplyData.fromJson(Map<String, dynamic> json) { ReplyReplyData.fromJson(Map<String, dynamic> json) {
page = ReplyPage.fromJson(json['page']); page = json['page'] == null ? null : ReplyPage.fromJson(json['page']);
config = ReplyConfig.fromJson(json['config']); config =
json['config'] == null ? null : ReplyConfig.fromJson(json['config']);
replies = (json['replies'] as List?) replies = (json['replies'] as List?)
?.map<ReplyItemModel>( ?.map<ReplyItemModel>(
(item) => ReplyItemModel.fromJson(item, json['upper']['mid'])) (item) => ReplyItemModel.fromJson(item, json['upper']['mid']))
@@ -69,7 +70,9 @@ class ReplyReplyData {
item, json['upper']['mid'], item, json['upper']['mid'],
isTopStatus: true)) isTopStatus: true))
.toList(); .toList();
upper = ReplyUpper.fromJson(json['upper']); upper = json['upper'] == null ? null : ReplyUpper.fromJson(json['upper']);
root = ReplyItemModel.fromJson(json['root'], json['upper']['mid']); root = json['root'] == null
? null
: ReplyItemModel.fromJson(json['root'], json['upper']?['mid']);
} }
} }

View File

@@ -84,13 +84,16 @@ class ReplyItemModel {
parentStr = json['parent_str']; parentStr = json['parent_str'];
like = json['like']; like = json['like'];
action = json['action']; action = json['action'];
member = ReplyMember.fromJson(json['member']); member =
content = ReplyContent.fromJson(json['content']); json['member'] == null ? null : ReplyMember.fromJson(json['member']);
content =
json['content'] == null ? null : ReplyContent.fromJson(json['content']);
replies = (json['replies'] as List?) replies = (json['replies'] as List?)
?.map((item) => ReplyItemModel.fromJson(item, upperMid)) ?.map((item) => ReplyItemModel.fromJson(item, upperMid))
.toList(); .toList();
assist = json['assist']; assist = json['assist'];
upAction = UpAction.fromJson(json['up_action']); upAction =
json['up_action'] == null ? null : UpAction.fromJson(json['up_action']);
invisible = json['invisible']; invisible = json['invisible'];
replyControl = json['reply_control'] == null replyControl = json['reply_control'] == null
? null ? null

View File

@@ -28,7 +28,8 @@ class ReplyMember {
sign = json['sign']; sign = json['sign'];
avatar = json['avatar']; avatar = json['avatar'];
level = json['level_info']['current_level']; level = json['level_info']['current_level'];
pendant = Pendant.fromJson(json['pendant']); pendant =
json['pendant'] == null ? null : Pendant.fromJson(json['pendant']);
officialVerify = json['official_verify']; officialVerify = json['official_verify'];
vip = json['vip']; vip = json['vip'];
fansDetail = json['fans_detail']; fansDetail = json['fans_detail'];