fix: reply model null error

This commit is contained in:
guozhigq
2024-10-24 00:35:32 +08:00
parent 96dc9ee230
commit 55ae549b98
2 changed files with 9 additions and 6 deletions

View File

@ -73,7 +73,7 @@ class ReplyCursor {
isEnd = json['is_end'];
mode = json['mode'];
modeText = json['mode_text'];
allCount = json['all_count'];
allCount = json['all_count'] ?? 0;
supportMode = json['support_mode'].cast<int>();
name = json['name'];
paginationReply = json['pagination_reply'] != null

View File

@ -31,7 +31,7 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
with TickerProviderStateMixin {
late DynamicDetailController _dynamicDetailController;
late AnimationController fabAnimationCtr;
Future? _futureBuilderFuture;
late Future _futureBuilderFuture;
late StreamController<bool> titleStreamC =
StreamController<bool>.broadcast(); // appBar title
late ScrollController scrollController;
@ -278,8 +278,8 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
future: _futureBuilderFuture,
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
Map data = snapshot.data as Map;
if (snapshot.data['status']) {
Map? data = snapshot.data;
if (data != null && snapshot.data['status']) {
RxList<ReplyItemModel> replyList =
_dynamicDetailController.replyList;
// 请求成功
@ -345,8 +345,11 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
} else {
// 请求错误
return HttpError(
errMsg: data['msg'],
fn: () => setState(() {}),
errMsg: data?['msg'] ?? '请求异常',
fn: () => setState(() {
_futureBuilderFuture =
_dynamicDetailController.queryReplyList();
}),
);
}
} else {