opt: 搜索结果为空

This commit is contained in:
guozhigq
2024-06-16 19:09:05 +08:00
parent 568642ad2f
commit 3b75b0ce7d
5 changed files with 72 additions and 43 deletions

View File

@ -5,10 +5,12 @@ class SearchVideoModel {
SearchVideoModel({this.list});
List<SearchVideoItemModel>? list;
SearchVideoModel.fromJson(Map<String, dynamic> json) {
list = json['result']
.where((e) => e['available'] == true)
.map<SearchVideoItemModel>((e) => SearchVideoItemModel.fromJson(e))
.toList();
list = json['result'] == null
? []
: json['result']
.where((e) => e['available'] == true)
.map<SearchVideoItemModel>((e) => SearchVideoItemModel.fromJson(e))
.toList();
}
}