This commit is contained in:
2026-03-07 17:24:59 +08:00
parent 4418ebecac
commit b0ec8ab4bd
417 changed files with 42546 additions and 2 deletions

View File

@@ -0,0 +1,38 @@
import 'dart:convert';
T? asT<T>(dynamic value) {
if (value is T) {
return value;
}
return null;
}
class NovelCategoryModel {
NovelCategoryModel({
required this.tagId,
required this.title,
required this.cover,
});
factory NovelCategoryModel.fromJson(Map<String, dynamic> json) =>
NovelCategoryModel(
tagId: asT<int>(json['tagId'])!,
title: asT<String>(json['title'])!,
cover: asT<String>(json['cover'])!,
);
int tagId;
String title;
String cover;
@override
String toString() {
return jsonEncode(this);
}
Map<String, dynamic> toJson() => <String, dynamic>{
'tag_id': tagId,
'title': title,
'cover': cover,
};
}