import 'dart:convert'; import 'package:huixiang/retrofit/data/author.dart'; /// id : "4" /// createTime : "2021-07-05 14:20:43" /// createUser : null /// updateTime : "2021-07-05 14:23:47" /// updateUser : null /// storeId : "0" /// mainTitle : "牡丹花的养护知识" /// viceTitle : null /// content : "阿斯顿发斯蒂芬" /// coverImg : "https://pos.upload.gznl.top/MDAwMA==/2021/06/2a1060d8-08f6-4036-935a-0514aaade9d8.jpg" /// author : "{\"name\":\"百花谷\",\"avatar\":\"https://pos.upload.gznl.top/MDAwMA==/2021/06/6a3586dc-a340-470f-b645-1e3155d5f558.jpg\"}" /// type : 2 /// startTime : "2021-07-05 14:25:10" /// endTime : "2099-01-01 00:00:00" /// state : 1 /// isDelete : 0 /// storeName : null class Article { String _id; String _createTime; dynamic _createUser; String _updateTime; dynamic _updateUser; String _storeId; String _mainTitle; dynamic _viceTitle; String _content; String _coverImg; Author _author; int _type; String _startTime; String _endTime; int _state; int _isDelete; int _likes; bool _isHot; int _viewers; dynamic _storeName; String get id => _id; String get createTime => _createTime; dynamic get createUser => _createUser; String get updateTime => _updateTime; dynamic get updateUser => _updateUser; String get storeId => _storeId; String get mainTitle => _mainTitle; dynamic get viceTitle => _viceTitle; String get content => _content; String get coverImg => _coverImg; Author get author => _author; int get type => _type; String get startTime => _startTime; String get endTime => _endTime; int get state => _state; int get isDelete => _isDelete; int get likes => _likes; bool get isHot => _isHot; int get viewers => _viewers; dynamic get storeName => _storeName; set likes(int value) { _likes = value; } Article({ String id, String createTime, dynamic createUser, String updateTime, dynamic updateUser, String storeId, String mainTitle, dynamic viceTitle, String content, String coverImg, Author author, int type, String startTime, String endTime, int state, int isDelete, int likes, bool isHot, int viewers, dynamic storeName}){ _id = id; _createTime = createTime; _createUser = createUser; _updateTime = updateTime; _updateUser = updateUser; _storeId = storeId; _mainTitle = mainTitle; _viceTitle = viceTitle; _content = content; _coverImg = coverImg; _author = author; _type = type; _startTime = startTime; _endTime = endTime; _state = state; _isDelete = isDelete; _likes = likes; _isHot = isHot; _viewers = viewers; _storeName = storeName; } Article.fromJson(dynamic json) { _id = json["id"]; _createTime = json["createTime"]; _createUser = json["createUser"]; _updateTime = json["updateTime"]; _updateUser = json["updateUser"]; _storeId = json["storeId"]; _mainTitle = json["mainTitle"]; _viceTitle = json["viceTitle"]; _content = json["content"]; _coverImg = json["coverImg"]; _author = Author.fromJson(jsonDecode(json["author"])); _type = json["type"]; _startTime = json["startTime"]; _endTime = json["endTime"]; _state = json["state"]; _isDelete = json["isDelete"]; _likes = json["likes"]; _isHot = json["isHot"]; _viewers = json["viewers"]; _storeName = json["storeName"]; } Map toJson() { var map = {}; map["id"] = _id; map["createTime"] = _createTime; map["createUser"] = _createUser; map["updateTime"] = _updateTime; map["updateUser"] = _updateUser; map["storeId"] = _storeId; map["mainTitle"] = _mainTitle; map["viceTitle"] = _viceTitle; map["content"] = _content; map["coverImg"] = _coverImg; map["author"] = _author.toJson(); map["type"] = _type; map["startTime"] = _startTime; map["endTime"] = _endTime; map["state"] = _state; map["isDelete"] = _isDelete; map["likes"] = _likes; map["isHot"] = _isHot; map["viewers"] = _viewers; map["storeName"] = _storeName; return map; } }