/netease_cloud_music/lib/model/recommend.dart

https://github.com/fluttercandies/NeteaseCloudMusic · Dart · 346 lines · 331 code · 15 blank · 0 comment · 7 complexity · 4d782aef2dad95ffc50163934ffcfb5e MD5 · raw file

  1. import 'package:flutter/foundation.dart';
  2. class RecommendData {
  3. int _code;
  4. bool _featureFirst;
  5. bool _haveRcmdSongs;
  6. List<Recommend> _recommend;
  7. RecommendData(
  8. {int code,
  9. bool featureFirst,
  10. bool haveRcmdSongs,
  11. List<Recommend> recommend}) {
  12. this._code = code;
  13. this._featureFirst = featureFirst;
  14. this._haveRcmdSongs = haveRcmdSongs;
  15. this._recommend = recommend;
  16. }
  17. int get code => _code;
  18. set code(int code) => _code = code;
  19. bool get featureFirst => _featureFirst;
  20. set featureFirst(bool featureFirst) => _featureFirst = featureFirst;
  21. bool get haveRcmdSongs => _haveRcmdSongs;
  22. set haveRcmdSongs(bool haveRcmdSongs) => _haveRcmdSongs = haveRcmdSongs;
  23. List<Recommend> get recommend => _recommend;
  24. set recommend(List<Recommend> recommend) => _recommend = recommend;
  25. RecommendData.fromJson(Map<String, dynamic> json) {
  26. _code = json['code'];
  27. _featureFirst = json['featureFirst'];
  28. _haveRcmdSongs = json['haveRcmdSongs'];
  29. if (json['recommend'] != null) {
  30. _recommend = new List<Recommend>();
  31. json['recommend'].forEach((v) {
  32. _recommend.add(new Recommend.fromJson(v));
  33. });
  34. }
  35. }
  36. Map<String, dynamic> toJson() {
  37. final Map<String, dynamic> data = new Map<String, dynamic>();
  38. data['code'] = this._code;
  39. data['featureFirst'] = this._featureFirst;
  40. data['haveRcmdSongs'] = this._haveRcmdSongs;
  41. if (this._recommend != null) {
  42. data['recommend'] = this._recommend.map((v) => v.toJson()).toList();
  43. }
  44. return data;
  45. }
  46. }
  47. class Recommend {
  48. int _id;
  49. int _type;
  50. String _name;
  51. String _copywriter;
  52. String _picUrl;
  53. int _playcount;
  54. int _createTime;
  55. Creator _creator;
  56. int _trackCount;
  57. int _userId;
  58. String _alg;
  59. Recommend(
  60. {int id,
  61. int type,
  62. String name,
  63. String copywriter,
  64. String picUrl,
  65. int playcount,
  66. int createTime,
  67. Creator creator,
  68. int trackCount,
  69. int userId,
  70. String alg}) {
  71. this._id = id;
  72. this._type = type;
  73. this._name = name;
  74. this._copywriter = copywriter;
  75. this._picUrl = picUrl;
  76. this._playcount = playcount;
  77. this._createTime = createTime;
  78. this._creator = creator;
  79. this._trackCount = trackCount;
  80. this._userId = userId;
  81. this._alg = alg;
  82. }
  83. int get id => _id;
  84. set id(int id) => _id = id;
  85. int get type => _type;
  86. set type(int type) => _type = type;
  87. String get name => _name;
  88. set name(String name) => _name = name;
  89. String get copywriter => _copywriter;
  90. set copywriter(String copywriter) => _copywriter = copywriter;
  91. String get picUrl => _picUrl;
  92. set picUrl(String picUrl) => _picUrl = picUrl;
  93. int get playcount => _playcount;
  94. set playcount(int playcount) => _playcount = playcount;
  95. int get createTime => _createTime;
  96. set createTime(int createTime) => _createTime = createTime;
  97. Creator get creator => _creator;
  98. set creator(Creator creator) => _creator = creator;
  99. int get trackCount => _trackCount;
  100. set trackCount(int trackCount) => _trackCount = trackCount;
  101. int get userId => _userId;
  102. set userId(int userId) => _userId = userId;
  103. String get alg => _alg;
  104. set alg(String alg) => _alg = alg;
  105. Recommend.fromJson(Map<String, dynamic> json) {
  106. _id = json['id'];
  107. _type = json['type'];
  108. _name = json['name'];
  109. _copywriter = json['copywriter'];
  110. _picUrl = json['picUrl'];
  111. _playcount = json['playcount'];
  112. _createTime = json['createTime'];
  113. _creator =
  114. json['creator'] != null ? new Creator.fromJson(json['creator']) : null;
  115. _trackCount = json['trackCount'];
  116. _userId = json['userId'];
  117. _alg = json['alg'];
  118. }
  119. Map<String, dynamic> toJson() {
  120. final Map<String, dynamic> data = new Map<String, dynamic>();
  121. data['id'] = this._id;
  122. data['type'] = this._type;
  123. data['name'] = this._name;
  124. data['copywriter'] = this._copywriter;
  125. data['picUrl'] = this._picUrl;
  126. data['playcount'] = this._playcount;
  127. data['createTime'] = this._createTime;
  128. if (this._creator != null) {
  129. data['creator'] = this._creator.toJson();
  130. }
  131. data['trackCount'] = this._trackCount;
  132. data['userId'] = this._userId;
  133. data['alg'] = this._alg;
  134. return data;
  135. }
  136. }
  137. class Creator {
  138. String _remarkName;
  139. bool _mutual;
  140. int _avatarImgId;
  141. int _backgroundImgId;
  142. String _detailDescription;
  143. bool _defaultAvatar;
  144. List _expertTags;
  145. int _djStatus;
  146. bool _followed;
  147. String _backgroundUrl;
  148. String _backgroundImgIdStr;
  149. String _avatarImgIdStr;
  150. int _accountStatus;
  151. int _userId;
  152. int _vipType;
  153. int _province;
  154. String _avatarUrl;
  155. int _authStatus;
  156. int _userType;
  157. String _nickname;
  158. int _gender;
  159. int _birthday;
  160. int _city;
  161. String _description;
  162. String _signature;
  163. int _authority;
  164. Creator(
  165. {String remarkName,
  166. bool mutual,
  167. int avatarImgId,
  168. int backgroundImgId,
  169. String detailDescription,
  170. bool defaultAvatar,
  171. List expertTags,
  172. int djStatus,
  173. bool followed,
  174. String backgroundUrl,
  175. String backgroundImgIdStr,
  176. String avatarImgIdStr,
  177. int accountStatus,
  178. int userId,
  179. int vipType,
  180. int province,
  181. String avatarUrl,
  182. int authStatus,
  183. int userType,
  184. String nickname,
  185. int gender,
  186. int birthday,
  187. int city,
  188. String description,
  189. String signature,
  190. int authority}) {
  191. this._remarkName = remarkName;
  192. this._mutual = mutual;
  193. this._avatarImgId = avatarImgId;
  194. this._backgroundImgId = backgroundImgId;
  195. this._detailDescription = detailDescription;
  196. this._defaultAvatar = defaultAvatar;
  197. this._expertTags = expertTags;
  198. this._djStatus = djStatus;
  199. this._followed = followed;
  200. this._backgroundUrl = backgroundUrl;
  201. this._backgroundImgIdStr = backgroundImgIdStr;
  202. this._avatarImgIdStr = avatarImgIdStr;
  203. this._accountStatus = accountStatus;
  204. this._userId = userId;
  205. this._vipType = vipType;
  206. this._province = province;
  207. this._avatarUrl = avatarUrl;
  208. this._authStatus = authStatus;
  209. this._userType = userType;
  210. this._nickname = nickname;
  211. this._gender = gender;
  212. this._birthday = birthday;
  213. this._city = city;
  214. this._description = description;
  215. this._signature = signature;
  216. this._authority = authority;
  217. }
  218. String get remarkName => _remarkName;
  219. set remarkName(String remarkName) => _remarkName = remarkName;
  220. bool get mutual => _mutual;
  221. set mutual(bool mutual) => _mutual = mutual;
  222. int get avatarImgId => _avatarImgId;
  223. set avatarImgId(int avatarImgId) => _avatarImgId = avatarImgId;
  224. int get backgroundImgId => _backgroundImgId;
  225. set backgroundImgId(int backgroundImgId) =>
  226. _backgroundImgId = backgroundImgId;
  227. String get detailDescription => _detailDescription;
  228. set detailDescription(String detailDescription) =>
  229. _detailDescription = detailDescription;
  230. bool get defaultAvatar => _defaultAvatar;
  231. set defaultAvatar(bool defaultAvatar) => _defaultAvatar = defaultAvatar;
  232. List get expertTags => _expertTags;
  233. set expertTags(List expertTags) => _expertTags = expertTags;
  234. int get djStatus => _djStatus;
  235. set djStatus(int djStatus) => _djStatus = djStatus;
  236. bool get followed => _followed;
  237. set followed(bool followed) => _followed = followed;
  238. String get backgroundUrl => _backgroundUrl;
  239. set backgroundUrl(String backgroundUrl) => _backgroundUrl = backgroundUrl;
  240. String get backgroundImgIdStr => _backgroundImgIdStr;
  241. set backgroundImgIdStr(String backgroundImgIdStr) =>
  242. _backgroundImgIdStr = backgroundImgIdStr;
  243. String get avatarImgIdStr => _avatarImgIdStr;
  244. set avatarImgIdStr(String avatarImgIdStr) => _avatarImgIdStr = avatarImgIdStr;
  245. int get accountStatus => _accountStatus;
  246. set accountStatus(int accountStatus) => _accountStatus = accountStatus;
  247. int get userId => _userId;
  248. set userId(int userId) => _userId = userId;
  249. int get vipType => _vipType;
  250. set vipType(int vipType) => _vipType = vipType;
  251. int get province => _province;
  252. set province(int province) => _province = province;
  253. String get avatarUrl => _avatarUrl;
  254. set avatarUrl(String avatarUrl) => _avatarUrl = avatarUrl;
  255. int get authStatus => _authStatus;
  256. set authStatus(int authStatus) => _authStatus = authStatus;
  257. int get userType => _userType;
  258. set userType(int userType) => _userType = userType;
  259. String get nickname => _nickname;
  260. set nickname(String nickname) => _nickname = nickname;
  261. int get gender => _gender;
  262. set gender(int gender) => _gender = gender;
  263. int get birthday => _birthday;
  264. set birthday(int birthday) => _birthday = birthday;
  265. int get city => _city;
  266. set city(int city) => _city = city;
  267. String get description => _description;
  268. set description(String description) => _description = description;
  269. String get signature => _signature;
  270. set signature(String signature) => _signature = signature;
  271. int get authority => _authority;
  272. set authority(int authority) => _authority = authority;
  273. Creator.fromJson(Map<String, dynamic> json) {
  274. _remarkName = json['remarkName'];
  275. _mutual = json['mutual'];
  276. _avatarImgId = json['avatarImgId'];
  277. _backgroundImgId = json['backgroundImgId'];
  278. _detailDescription = json['detailDescription'];
  279. _defaultAvatar = json['defaultAvatar'];
  280. _expertTags = json['expertTags'];
  281. _djStatus = json['djStatus'];
  282. _followed = json['followed'];
  283. _backgroundUrl = json['backgroundUrl'];
  284. _backgroundImgIdStr = json['backgroundImgIdStr'];
  285. _avatarImgIdStr = json['avatarImgIdStr'];
  286. _accountStatus = json['accountStatus'];
  287. _userId = json['userId'];
  288. _vipType = json['vipType'];
  289. _province = json['province'];
  290. _avatarUrl = json['avatarUrl'];
  291. _authStatus = json['authStatus'];
  292. _userType = json['userType'];
  293. _nickname = json['nickname'];
  294. _gender = json['gender'];
  295. _birthday = json['birthday'];
  296. _city = json['city'];
  297. _description = json['description'];
  298. _signature = json['signature'];
  299. _authority = json['authority'];
  300. }
  301. Map<String, dynamic> toJson() {
  302. final Map<String, dynamic> data = new Map<String, dynamic>();
  303. data['remarkName'] = this._remarkName;
  304. data['mutual'] = this._mutual;
  305. data['avatarImgId'] = this._avatarImgId;
  306. data['backgroundImgId'] = this._backgroundImgId;
  307. data['detailDescription'] = this._detailDescription;
  308. data['defaultAvatar'] = this._defaultAvatar;
  309. data['expertTags'] = this._expertTags;
  310. data['djStatus'] = this._djStatus;
  311. data['followed'] = this._followed;
  312. data['backgroundUrl'] = this._backgroundUrl;
  313. data['backgroundImgIdStr'] = this._backgroundImgIdStr;
  314. data['avatarImgIdStr'] = this._avatarImgIdStr;
  315. data['accountStatus'] = this._accountStatus;
  316. data['userId'] = this._userId;
  317. data['vipType'] = this._vipType;
  318. data['province'] = this._province;
  319. data['avatarUrl'] = this._avatarUrl;
  320. data['authStatus'] = this._authStatus;
  321. data['userType'] = this._userType;
  322. data['nickname'] = this._nickname;
  323. data['gender'] = this._gender;
  324. data['birthday'] = this._birthday;
  325. data['city'] = this._city;
  326. data['description'] = this._description;
  327. data['signature'] = this._signature;
  328. data['authority'] = this._authority;
  329. return data;
  330. }
  331. }