import 'package:akuCommunity/model/common/img_model.dart'; import 'package:flustars/flustars.dart'; class BoardItemModel { int id; String title; String releaseTime; List imgUrls; DateTime get releaseDate => DateUtil.getDateTime(releaseTime); BoardItemModel({this.id, this.title, this.releaseTime, this.imgUrls}); BoardItemModel.fromJson(Map json) { id = json['id']; title = json['title']; releaseTime = json['releaseTime']; if (json['imgUrls'] != null) { imgUrls = new List(); json['imgUrls'].forEach((v) { imgUrls.add(new ImgModel.fromJson(v)); }); } } Map toJson() { final Map data = new Map(); data['id'] = this.id; data['title'] = this.title; data['releaseTime'] = this.releaseTime; if (this.imgUrls != null) { data['imgUrls'] = this.imgUrls.map((v) => v.toJson()).toList(); } return data; } }