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:
@@ -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'];
|
||||
}
|
||||
|
||||
@@ -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'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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'];
|
||||
}
|
||||
|
||||
@@ -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(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user