import 'dart:convert'; T? asT(dynamic value) { if (value is T) { return value; } return null; } class ComicChapterDetailWebModel { ComicChapterDetailWebModel({ required this.id, required this.comicId, required this.chapterName, required this.chapterOrder, required this.createtime, required this.folder, required this.pageUrl, required this.chapterType, required this.chaptertype, required this.chapterTrueType, required this.chapterNum, required this.updatetime, required this.sumPages, required this.snsTag, required this.uid, required this.username, required this.translatorid, required this.translator, required this.link, required this.message, required this.download, required this.hidden, required this.direction, required this.filesize, required this.highFileSize, required this.picnum, required this.hit, required this.nextChapId, required this.prevChapId, required this.commentCount, }); factory ComicChapterDetailWebModel.fromJson(Map json) { final List? pageUrl = json['page_url'] is List ? [] : null; if (pageUrl != null) { for (final dynamic item in json['page_url']!) { if (item != null) { pageUrl.add(asT(item)!); } } } return ComicChapterDetailWebModel( id: asT(json['id'])!, comicId: asT(json['comic_id'])!, chapterName: asT(json['chapter_name'])!, chapterOrder: asT(json['chapter_order'])!, createtime: asT(json['createtime'])!, folder: asT(json['folder'])!, pageUrl: pageUrl!, chapterType: asT(json['chapter_type'])!, chaptertype: asT(json['chaptertype'])!, chapterTrueType: asT(json['chapter_true_type'])!, chapterNum: asT(json['chapter_num']) ?? 0, updatetime: asT(json['updatetime'])!, sumPages: asT(json['sum_pages'])!, snsTag: asT(json['sns_tag'])!, uid: asT(json['uid'])!, username: asT(json['username'])!, translatorid: asT(json['translatorid'])!, translator: asT(json['translator'])!, link: asT(json['link'])!, message: asT(json['message'])!, download: asT(json['download'])!, hidden: asT(json['hidden'])!, direction: asT(json['direction']) ?? 0, filesize: asT(json['filesize']) ?? 0, highFileSize: asT(json['high_file_size']) ?? 0, picnum: asT(json['picnum']) ?? 0, hit: asT(json['hit'])!, nextChapId: asT(json['next_chap_id']) ?? 0, prevChapId: asT(json['prev_chap_id']) ?? 0, commentCount: asT(json['comment_count'])!, ); } int id; int comicId; String chapterName; int chapterOrder; int createtime; String folder; List pageUrl; int chapterType; int chaptertype; int chapterTrueType; int chapterNum; int updatetime; int sumPages; int snsTag; int uid; String username; String translatorid; String translator; String link; String message; String download; int hidden; int direction; int filesize; int highFileSize; int picnum; int hit; int nextChapId; int prevChapId; int commentCount; @override String toString() { return jsonEncode(this); } Map toJson() => { 'id': id, 'comic_id': comicId, 'chapter_name': chapterName, 'chapter_order': chapterOrder, 'createtime': createtime, 'folder': folder, 'page_url': pageUrl, 'chapter_type': chapterType, 'chaptertype': chaptertype, 'chapter_true_type': chapterTrueType, 'chapter_num': chapterNum, 'updatetime': updatetime, 'sum_pages': sumPages, 'sns_tag': snsTag, 'uid': uid, 'username': username, 'translatorid': translatorid, 'translator': translator, 'link': link, 'message': message, 'download': download, 'hidden': hidden, 'direction': direction, 'filesize': filesize, 'high_file_size': highFileSize, 'picnum': picnum, 'hit': hit, 'next_chap_id': nextChapId, 'prev_chap_id': prevChapId, 'comment_count': commentCount, }; }