import 'package:akuCommunity/model/common/img_model.dart'; class CommunityTopicModel { int id; String title; String summary; String content; List imgUrl; int activityNum; CommunityTopicModel( {this.id, this.title, this.summary, this.content, this.imgUrl, this.activityNum}); CommunityTopicModel.fromJson(Map json) { id = json['id']; title = json['title']; summary = json['summary']; content = json['content']; if (json['imgUrl'] != null) { imgUrl = []; json['imgUrl'].forEach((v) { imgUrl.add(new ImgModel.fromJson(v)); }); } else imgUrl = []; activityNum = json['activityNum']; } Map toJson() { final Map data = new Map(); data['id'] = this.id; data['title'] = this.title; data['summary'] = this.summary; data['content'] = this.content; if (this.imgUrl != null) { data['imgUrl'] = this.imgUrl.map((v) => v.toJson()).toList(); } data['activityNum'] = this.activityNum; return data; } }