class NewStatisticModel { final List lists; NewStatisticModel({required this.lists}); factory NewStatisticModel.fromJson(Map json) { return NewStatisticModel( lists: List.from( json['lists'].map((x) => CategoryList.fromJson(x))), ); } Map toJson() { return { 'lists': List.from(lists.map((x) => x.toJson())), }; } } class CategoryList { final int category; final String header; final List contents; CategoryList( {required this.category, required this.header, required this.contents}); factory CategoryList.fromJson(Map json) { return CategoryList( category: json['category'], header: json['header'], contents: List.from(json['contents'].map((x) => Content.fromJson(x))), ); } Map toJson() { return { 'category': category, 'header': header, 'contents': List.from(contents.map((x) => x.toJson())), }; } } class Content { final int id; final String label; final String title; final bool marked; final Data data; Content( {required this.id, required this.label, required this.title, required this.marked, required this.data}); factory Content.fromJson(Map json) { return Content( id: json['id'], label: json['label'], title: json['title'], marked: json['marked'], data: Data.fromJson(json['data']), ); } Map toJson() { return { 'id': id, 'label': label, 'title': title, 'marked': marked, 'data': data.toJson(), }; } } class Data { final String p; final num dp; final String dt; Data({required this.p, required this.dp, required this.dt}); factory Data.fromJson(Map json) { return Data( p: json['p'], dp: json['dp'], dt: json['dt'], ); } Map toJson() { return { 'p': p, 'dp': dp, 'dt': dt, }; } }