import 'dart:convert'; T? asT(dynamic value) { if (value is T) { return value; } return null; } class ComicSpecialModel { ComicSpecialModel({ required this.id, required this.title, required this.shortTitle, required this.createTime, required this.smallCover, required this.pageType, required this.sort, required this.pageUrl, }); factory ComicSpecialModel.fromJson(Map json) => ComicSpecialModel( id: asT(json['id'])!, title: asT(json['title'])!, shortTitle: asT(json['short_title'])!, createTime: asT(json['create_time'])!, smallCover: asT(json['small_cover'])!, pageType: asT(json['page_type'])!, sort: asT(json['sort'])!, pageUrl: asT(json['page_url'])!, ); int id; String title; String shortTitle; int createTime; String smallCover; int pageType; int sort; String pageUrl; @override String toString() { return jsonEncode(this); } Map toJson() => { 'id': id, 'title': title, 'short_title': shortTitle, 'create_time': createTime, 'small_cover': smallCover, 'page_type': pageType, 'sort': sort, 'page_url': pageUrl, }; }