json_convert_content.dart 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789
  1. // ignore_for_file: non_constant_identifier_names
  2. // ignore_for_file: camel_case_types
  3. // ignore_for_file: prefer_single_quotes
  4. // This file is automatically generated. DO NOT EDIT, all your changes would be lost.
  5. import 'package:flutter/material.dart' show debugPrint;
  6. import 'package:domain/entity/auth_login_entity.dart';
  7. import 'package:domain/entity/captcha_img_entity.dart';
  8. import 'package:domain/entity/facility_book_entity.dart';
  9. import 'package:domain/entity/facility_index_entity.dart';
  10. import 'package:domain/entity/facility_page_entity.dart';
  11. import 'package:domain/entity/feedback_detail_entity.dart';
  12. import 'package:domain/entity/feedback_list_entity.dart';
  13. import 'package:domain/entity/form_content_entity.dart';
  14. import 'package:domain/entity/form_detail_entity.dart';
  15. import 'package:domain/entity/form_list_entity.dart';
  16. import 'package:domain/entity/form_option_entity.dart';
  17. import 'package:domain/entity/form_submitted_entity.dart';
  18. import 'package:domain/entity/form_submitted_page_entity.dart';
  19. import 'package:domain/entity/garage_sale_rent_detail_entity.dart';
  20. import 'package:domain/entity/garage_sale_rent_entity.dart';
  21. import 'package:domain/entity/id_name_entity.dart';
  22. import 'package:domain/entity/myfollowing_list_entity.dart';
  23. import 'package:domain/entity/myposts_newsfeed_entity.dart';
  24. import 'package:domain/entity/myposts_sale_rent_entity.dart';
  25. import 'package:domain/entity/newsfeed_comment_publish_entity.dart';
  26. import 'package:domain/entity/newsfeed_detail_entity.dart';
  27. import 'package:domain/entity/newsfeed_following_entity.dart';
  28. import 'package:domain/entity/newsfeed_foryou_entity.dart';
  29. import 'package:domain/entity/newsfeed_news_entity.dart';
  30. import 'package:domain/entity/notice_board_announ_detail_entity.dart';
  31. import 'package:domain/entity/notice_board_announ_entity.dart';
  32. import 'package:domain/entity/notice_board_documents_entity.dart';
  33. import 'package:domain/entity/notice_board_event_detail_entity.dart';
  34. import 'package:domain/entity/notice_board_event_entity.dart';
  35. import 'package:domain/entity/payment_page_entity.dart';
  36. import 'package:domain/entity/property_news_entity.dart';
  37. import 'package:domain/entity/property_sale_rent_entity.dart';
  38. import 'package:domain/entity/rewards_active_detail_entity.dart';
  39. import 'package:domain/entity/rewards_buy_entity.dart';
  40. import 'package:domain/entity/rewards_category_entity.dart';
  41. import 'package:domain/entity/rewards_detail_entity.dart';
  42. import 'package:domain/entity/rewards_history_earned_entity.dart';
  43. import 'package:domain/entity/rewards_home_entity.dart';
  44. import 'package:domain/entity/rewards_home_tes_entity.dart';
  45. import 'package:domain/entity/rewards_home_test_entity.dart';
  46. import 'package:domain/entity/rewards_home_tx_entity.dart';
  47. import 'package:domain/entity/rewards_index_entity.dart';
  48. import 'package:domain/entity/rewards_list_entity.dart';
  49. import 'package:domain/entity/rewards_my_detail_entity.dart';
  50. import 'package:domain/entity/rewards_my_entity.dart';
  51. import 'package:domain/entity/rewards_search_entity.dart';
  52. import 'package:domain/entity/server_time.dart';
  53. import 'package:domain/entity/text_kon_entity.dart';
  54. import 'package:domain/entity/user_me_entity.dart';
  55. import 'package:domain/entity/visitor_page_entity.dart';
  56. JsonConvert jsonConvert = JsonConvert();
  57. typedef JsonConvertFunction<T> = T Function(Map<String, dynamic> json);
  58. typedef EnumConvertFunction<T> = T Function(String value);
  59. typedef ConvertExceptionHandler = void Function(Object error, StackTrace stackTrace);
  60. extension MapSafeExt<K, V> on Map<K, V> {
  61. T? getOrNull<T>(K? key) {
  62. if (!containsKey(key) || key == null) {
  63. return null;
  64. } else {
  65. return this[key] as T?;
  66. }
  67. }
  68. }
  69. class JsonConvert {
  70. static ConvertExceptionHandler? onError;
  71. JsonConvertClassCollection convertFuncMap = JsonConvertClassCollection();
  72. /// When you are in the development, to generate a new model class, hot-reload doesn't find new generation model class, you can build on MaterialApp method called jsonConvert. ReassembleConvertFuncMap (); This method only works in a development environment
  73. /// https://flutter.cn/docs/development/tools/hot-reload
  74. /// class MyApp extends StatelessWidget {
  75. /// const MyApp({Key? key})
  76. /// : super(key: key);
  77. ///
  78. /// @override
  79. /// Widget build(BuildContext context) {
  80. /// jsonConvert.reassembleConvertFuncMap();
  81. /// return MaterialApp();
  82. /// }
  83. /// }
  84. void reassembleConvertFuncMap() {
  85. bool isReleaseMode = const bool.fromEnvironment('dart.vm.product');
  86. if (!isReleaseMode) {
  87. convertFuncMap = JsonConvertClassCollection();
  88. }
  89. }
  90. T? convert<T>(dynamic value, {EnumConvertFunction? enumConvert}) {
  91. if (value == null) {
  92. return null;
  93. }
  94. if (value is T) {
  95. return value;
  96. }
  97. try {
  98. return _asT<T>(value, enumConvert: enumConvert);
  99. } catch (e, stackTrace) {
  100. debugPrint('asT<$T> $e $stackTrace');
  101. if (onError != null) {
  102. onError!(e, stackTrace);
  103. }
  104. return null;
  105. }
  106. }
  107. List<T?>? convertList<T>(List<dynamic>? value,
  108. {EnumConvertFunction? enumConvert}) {
  109. if (value == null) {
  110. return null;
  111. }
  112. try {
  113. return value.map((dynamic e) => _asT<T>(e, enumConvert: enumConvert))
  114. .toList();
  115. } catch (e, stackTrace) {
  116. debugPrint('asT<$T> $e $stackTrace');
  117. if (onError != null) {
  118. onError!(e, stackTrace);
  119. }
  120. return <T>[];
  121. }
  122. }
  123. List<T>? convertListNotNull<T>(dynamic value,
  124. {EnumConvertFunction? enumConvert}) {
  125. if (value == null) {
  126. return null;
  127. }
  128. try {
  129. return (value as List<dynamic>).map((dynamic e) =>
  130. _asT<T>(e, enumConvert: enumConvert)!).toList();
  131. } catch (e, stackTrace) {
  132. debugPrint('asT<$T> $e $stackTrace');
  133. if (onError != null) {
  134. onError!(e, stackTrace);
  135. }
  136. return <T>[];
  137. }
  138. }
  139. T? _asT<T extends Object?>(dynamic value,
  140. {EnumConvertFunction? enumConvert}) {
  141. final String type = T.toString();
  142. final String valueS = value.toString();
  143. if (enumConvert != null) {
  144. return enumConvert(valueS) as T;
  145. } else if (type == "String") {
  146. return valueS as T;
  147. } else if (type == "int") {
  148. final int? intValue = int.tryParse(valueS);
  149. if (intValue == null) {
  150. return double.tryParse(valueS)?.toInt() as T?;
  151. } else {
  152. return intValue as T;
  153. }
  154. } else if (type == "double") {
  155. return double.parse(valueS) as T;
  156. } else if (type == "DateTime") {
  157. return DateTime.parse(valueS) as T;
  158. } else if (type == "bool") {
  159. if (valueS == '0' || valueS == '1') {
  160. return (valueS == '1') as T;
  161. }
  162. return (valueS == 'true') as T;
  163. } else if (type == "Map" || type.startsWith("Map<")) {
  164. return value as T;
  165. } else {
  166. if (convertFuncMap.containsKey(type)) {
  167. if (value == null) {
  168. return null;
  169. }
  170. var covertFunc = convertFuncMap[type]!;
  171. if (covertFunc is Map<String, dynamic>) {
  172. return covertFunc(value as Map<String, dynamic>) as T;
  173. } else {
  174. return covertFunc(Map<String, dynamic>.from(value)) as T;
  175. }
  176. } else {
  177. throw UnimplementedError(
  178. '$type unimplemented,you can try running the app again');
  179. }
  180. }
  181. }
  182. //list is returned by type
  183. static M? _getListChildType<M>(List<Map<String, dynamic>> data) {
  184. if (<AuthLoginEntity>[] is M) {
  185. return data.map<AuthLoginEntity>((Map<String, dynamic> e) =>
  186. AuthLoginEntity.fromJson(e)).toList() as M;
  187. }
  188. if (<CaptchaImgEntity>[] is M) {
  189. return data.map<CaptchaImgEntity>((Map<String, dynamic> e) =>
  190. CaptchaImgEntity.fromJson(e)).toList() as M;
  191. }
  192. if (<FacilityBookEntity>[] is M) {
  193. return data.map<FacilityBookEntity>((Map<String, dynamic> e) =>
  194. FacilityBookEntity.fromJson(e)).toList() as M;
  195. }
  196. if (<FacilityBookFacilityType>[] is M) {
  197. return data.map<FacilityBookFacilityType>((Map<String, dynamic> e) =>
  198. FacilityBookFacilityType.fromJson(e)).toList() as M;
  199. }
  200. if (<FacilityBookFacilities>[] is M) {
  201. return data.map<FacilityBookFacilities>((Map<String, dynamic> e) =>
  202. FacilityBookFacilities.fromJson(e)).toList() as M;
  203. }
  204. if (<FacilityBookFacilitiesPeriods>[] is M) {
  205. return data.map<FacilityBookFacilitiesPeriods>((Map<String, dynamic> e) =>
  206. FacilityBookFacilitiesPeriods.fromJson(e)).toList() as M;
  207. }
  208. if (<FacilityIndexEntity>[] is M) {
  209. return data.map<FacilityIndexEntity>((Map<String, dynamic> e) =>
  210. FacilityIndexEntity.fromJson(e)).toList() as M;
  211. }
  212. if (<FacilityPageEntity>[] is M) {
  213. return data.map<FacilityPageEntity>((Map<String, dynamic> e) =>
  214. FacilityPageEntity.fromJson(e)).toList() as M;
  215. }
  216. if (<FacilityDetail>[] is M) {
  217. return data.map<FacilityDetail>((Map<String, dynamic> e) =>
  218. FacilityDetail.fromJson(e)).toList() as M;
  219. }
  220. if (<FacilityPageListBooking>[] is M) {
  221. return data.map<FacilityPageListBooking>((Map<String, dynamic> e) =>
  222. FacilityPageListBooking.fromJson(e)).toList() as M;
  223. }
  224. if (<FacilityPageListFacility>[] is M) {
  225. return data.map<FacilityPageListFacility>((Map<String, dynamic> e) =>
  226. FacilityPageListFacility.fromJson(e)).toList() as M;
  227. }
  228. if (<FacilityPageListFacilityType>[] is M) {
  229. return data.map<FacilityPageListFacilityType>((Map<String, dynamic> e) =>
  230. FacilityPageListFacilityType.fromJson(e)).toList() as M;
  231. }
  232. if (<FacilityPageListTimePeriod>[] is M) {
  233. return data.map<FacilityPageListTimePeriod>((Map<String, dynamic> e) =>
  234. FacilityPageListTimePeriod.fromJson(e)).toList() as M;
  235. }
  236. if (<FacilityPageListAccount>[] is M) {
  237. return data.map<FacilityPageListAccount>((Map<String, dynamic> e) =>
  238. FacilityPageListAccount.fromJson(e)).toList() as M;
  239. }
  240. if (<FeedbackDetailEntity>[] is M) {
  241. return data.map<FeedbackDetailEntity>((Map<String, dynamic> e) =>
  242. FeedbackDetailEntity.fromJson(e)).toList() as M;
  243. }
  244. if (<FeedbackDetailReplies>[] is M) {
  245. return data.map<FeedbackDetailReplies>((Map<String, dynamic> e) =>
  246. FeedbackDetailReplies.fromJson(e)).toList() as M;
  247. }
  248. if (<FeedbackListEntity>[] is M) {
  249. return data.map<FeedbackListEntity>((Map<String, dynamic> e) =>
  250. FeedbackListEntity.fromJson(e)).toList() as M;
  251. }
  252. if (<FeedbackItemEntity>[] is M) {
  253. return data.map<FeedbackItemEntity>((Map<String, dynamic> e) =>
  254. FeedbackItemEntity.fromJson(e)).toList() as M;
  255. }
  256. if (<FormContentEntity>[] is M) {
  257. return data.map<FormContentEntity>((Map<String, dynamic> e) =>
  258. FormContentEntity.fromJson(e)).toList() as M;
  259. }
  260. if (<FormDetailEntity>[] is M) {
  261. return data.map<FormDetailEntity>((Map<String, dynamic> e) =>
  262. FormDetailEntity.fromJson(e)).toList() as M;
  263. }
  264. if (<FormListEntity>[] is M) {
  265. return data.map<FormListEntity>((Map<String, dynamic> e) =>
  266. FormListEntity.fromJson(e)).toList() as M;
  267. }
  268. if (<FormOptionEntity>[] is M) {
  269. return data.map<FormOptionEntity>((Map<String, dynamic> e) =>
  270. FormOptionEntity.fromJson(e)).toList() as M;
  271. }
  272. if (<FormSubmittedEntity>[] is M) {
  273. return data.map<FormSubmittedEntity>((Map<String, dynamic> e) =>
  274. FormSubmittedEntity.fromJson(e)).toList() as M;
  275. }
  276. if (<FormSubmittedEstateOnlineForm>[] is M) {
  277. return data.map<FormSubmittedEstateOnlineForm>((Map<String, dynamic> e) =>
  278. FormSubmittedEstateOnlineForm.fromJson(e)).toList() as M;
  279. }
  280. if (<FormSubmittedPageEntity>[] is M) {
  281. return data.map<FormSubmittedPageEntity>((Map<String, dynamic> e) =>
  282. FormSubmittedPageEntity.fromJson(e)).toList() as M;
  283. }
  284. if (<GarageSaleRentDetailEntity>[] is M) {
  285. return data.map<GarageSaleRentDetailEntity>((Map<String, dynamic> e) =>
  286. GarageSaleRentDetailEntity.fromJson(e)).toList() as M;
  287. }
  288. if (<GarageSaleRentDetailAccount>[] is M) {
  289. return data.map<GarageSaleRentDetailAccount>((Map<String, dynamic> e) =>
  290. GarageSaleRentDetailAccount.fromJson(e)).toList() as M;
  291. }
  292. if (<GarageSaleRentEntity>[] is M) {
  293. return data.map<GarageSaleRentEntity>((Map<String, dynamic> e) =>
  294. GarageSaleRentEntity.fromJson(e)).toList() as M;
  295. }
  296. if (<GarageSaleRentList>[] is M) {
  297. return data.map<GarageSaleRentList>((Map<String, dynamic> e) =>
  298. GarageSaleRentList.fromJson(e)).toList() as M;
  299. }
  300. if (<GarageSaleRentListAccount>[] is M) {
  301. return data.map<GarageSaleRentListAccount>((Map<String, dynamic> e) =>
  302. GarageSaleRentListAccount.fromJson(e)).toList() as M;
  303. }
  304. if (<IdNameEntity>[] is M) {
  305. return data.map<IdNameEntity>((Map<String, dynamic> e) =>
  306. IdNameEntity.fromJson(e)).toList() as M;
  307. }
  308. if (<MyfollowingListEntity>[] is M) {
  309. return data.map<MyfollowingListEntity>((Map<String, dynamic> e) =>
  310. MyfollowingListEntity.fromJson(e)).toList() as M;
  311. }
  312. if (<MypostsNewsfeedEntity>[] is M) {
  313. return data.map<MypostsNewsfeedEntity>((Map<String, dynamic> e) =>
  314. MypostsNewsfeedEntity.fromJson(e)).toList() as M;
  315. }
  316. if (<MypostsNewsfeedList>[] is M) {
  317. return data.map<MypostsNewsfeedList>((Map<String, dynamic> e) =>
  318. MypostsNewsfeedList.fromJson(e)).toList() as M;
  319. }
  320. if (<MypostsNewsfeedListAccount>[] is M) {
  321. return data.map<MypostsNewsfeedListAccount>((Map<String, dynamic> e) =>
  322. MypostsNewsfeedListAccount.fromJson(e)).toList() as M;
  323. }
  324. if (<MypostsSaleRentEntity>[] is M) {
  325. return data.map<MypostsSaleRentEntity>((Map<String, dynamic> e) =>
  326. MypostsSaleRentEntity.fromJson(e)).toList() as M;
  327. }
  328. if (<MypostsSaleRentList>[] is M) {
  329. return data.map<MypostsSaleRentList>((Map<String, dynamic> e) =>
  330. MypostsSaleRentList.fromJson(e)).toList() as M;
  331. }
  332. if (<NewsfeedCommentPublishEntity>[] is M) {
  333. return data.map<NewsfeedCommentPublishEntity>((Map<String, dynamic> e) =>
  334. NewsfeedCommentPublishEntity.fromJson(e)).toList() as M;
  335. }
  336. if (<NewsfeedDetailEntity>[] is M) {
  337. return data.map<NewsfeedDetailEntity>((Map<String, dynamic> e) =>
  338. NewsfeedDetailEntity.fromJson(e)).toList() as M;
  339. }
  340. if (<NewsfeedDetailAccount>[] is M) {
  341. return data.map<NewsfeedDetailAccount>((Map<String, dynamic> e) =>
  342. NewsfeedDetailAccount.fromJson(e)).toList() as M;
  343. }
  344. if (<NewsfeedDetailComments>[] is M) {
  345. return data.map<NewsfeedDetailComments>((Map<String, dynamic> e) =>
  346. NewsfeedDetailComments.fromJson(e)).toList() as M;
  347. }
  348. if (<NewsfeedDetailCommentsAccount>[] is M) {
  349. return data.map<NewsfeedDetailCommentsAccount>((Map<String, dynamic> e) =>
  350. NewsfeedDetailCommentsAccount.fromJson(e)).toList() as M;
  351. }
  352. if (<NewsfeedDetailCommentsToAccount>[] is M) {
  353. return data.map<NewsfeedDetailCommentsToAccount>((
  354. Map<String, dynamic> e) =>
  355. NewsfeedDetailCommentsToAccount.fromJson(e)).toList() as M;
  356. }
  357. if (<NewsfeedFollowingEntity>[] is M) {
  358. return data.map<NewsfeedFollowingEntity>((Map<String, dynamic> e) =>
  359. NewsfeedFollowingEntity.fromJson(e)).toList() as M;
  360. }
  361. if (<NewsfeedFollowingList>[] is M) {
  362. return data.map<NewsfeedFollowingList>((Map<String, dynamic> e) =>
  363. NewsfeedFollowingList.fromJson(e)).toList() as M;
  364. }
  365. if (<NewsfeedFollowingListAccount>[] is M) {
  366. return data.map<NewsfeedFollowingListAccount>((Map<String, dynamic> e) =>
  367. NewsfeedFollowingListAccount.fromJson(e)).toList() as M;
  368. }
  369. if (<NewsfeedForyouEntity>[] is M) {
  370. return data.map<NewsfeedForyouEntity>((Map<String, dynamic> e) =>
  371. NewsfeedForyouEntity.fromJson(e)).toList() as M;
  372. }
  373. if (<NewsfeedForyouList>[] is M) {
  374. return data.map<NewsfeedForyouList>((Map<String, dynamic> e) =>
  375. NewsfeedForyouList.fromJson(e)).toList() as M;
  376. }
  377. if (<NewsfeedForyouListAccount>[] is M) {
  378. return data.map<NewsfeedForyouListAccount>((Map<String, dynamic> e) =>
  379. NewsfeedForyouListAccount.fromJson(e)).toList() as M;
  380. }
  381. if (<NewsfeedNewsEntity>[] is M) {
  382. return data.map<NewsfeedNewsEntity>((Map<String, dynamic> e) =>
  383. NewsfeedNewsEntity.fromJson(e)).toList() as M;
  384. }
  385. if (<NewsfeedNewsList>[] is M) {
  386. return data.map<NewsfeedNewsList>((Map<String, dynamic> e) =>
  387. NewsfeedNewsList.fromJson(e)).toList() as M;
  388. }
  389. if (<NewsfeedNewsListAccount>[] is M) {
  390. return data.map<NewsfeedNewsListAccount>((Map<String, dynamic> e) =>
  391. NewsfeedNewsListAccount.fromJson(e)).toList() as M;
  392. }
  393. if (<NoticeBoardAnnounDetailEntity>[] is M) {
  394. return data.map<NoticeBoardAnnounDetailEntity>((Map<String, dynamic> e) =>
  395. NoticeBoardAnnounDetailEntity.fromJson(e)).toList() as M;
  396. }
  397. if (<NoticeBoardAnnounEntity>[] is M) {
  398. return data.map<NoticeBoardAnnounEntity>((Map<String, dynamic> e) =>
  399. NoticeBoardAnnounEntity.fromJson(e)).toList() as M;
  400. }
  401. if (<NoticeBoardAnnounList>[] is M) {
  402. return data.map<NoticeBoardAnnounList>((Map<String, dynamic> e) =>
  403. NoticeBoardAnnounList.fromJson(e)).toList() as M;
  404. }
  405. if (<NoticeBoardDocumentsEntity>[] is M) {
  406. return data.map<NoticeBoardDocumentsEntity>((Map<String, dynamic> e) =>
  407. NoticeBoardDocumentsEntity.fromJson(e)).toList() as M;
  408. }
  409. if (<NoticeBoardDocumentsList>[] is M) {
  410. return data.map<NoticeBoardDocumentsList>((Map<String, dynamic> e) =>
  411. NoticeBoardDocumentsList.fromJson(e)).toList() as M;
  412. }
  413. if (<NoticeBoardEventDetailEntity>[] is M) {
  414. return data.map<NoticeBoardEventDetailEntity>((Map<String, dynamic> e) =>
  415. NoticeBoardEventDetailEntity.fromJson(e)).toList() as M;
  416. }
  417. if (<NoticeBoardEventEntity>[] is M) {
  418. return data.map<NoticeBoardEventEntity>((Map<String, dynamic> e) =>
  419. NoticeBoardEventEntity.fromJson(e)).toList() as M;
  420. }
  421. if (<NoticeBoardEventList>[] is M) {
  422. return data.map<NoticeBoardEventList>((Map<String, dynamic> e) =>
  423. NoticeBoardEventList.fromJson(e)).toList() as M;
  424. }
  425. if (<PaymentPageEntity>[] is M) {
  426. return data.map<PaymentPageEntity>((Map<String, dynamic> e) =>
  427. PaymentPageEntity.fromJson(e)).toList() as M;
  428. }
  429. if (<PaymentPageList>[] is M) {
  430. return data.map<PaymentPageList>((Map<String, dynamic> e) =>
  431. PaymentPageList.fromJson(e)).toList() as M;
  432. }
  433. if (<PropertyNewsEntity>[] is M) {
  434. return data.map<PropertyNewsEntity>((Map<String, dynamic> e) =>
  435. PropertyNewsEntity.fromJson(e)).toList() as M;
  436. }
  437. if (<PropertyNewsList>[] is M) {
  438. return data.map<PropertyNewsList>((Map<String, dynamic> e) =>
  439. PropertyNewsList.fromJson(e)).toList() as M;
  440. }
  441. if (<PropertySaleRentEntity>[] is M) {
  442. return data.map<PropertySaleRentEntity>((Map<String, dynamic> e) =>
  443. PropertySaleRentEntity.fromJson(e)).toList() as M;
  444. }
  445. if (<PropertySaleRentList>[] is M) {
  446. return data.map<PropertySaleRentList>((Map<String, dynamic> e) =>
  447. PropertySaleRentList.fromJson(e)).toList() as M;
  448. }
  449. if (<RewardsActiveDetailEntity>[] is M) {
  450. return data.map<RewardsActiveDetailEntity>((Map<String, dynamic> e) =>
  451. RewardsActiveDetailEntity.fromJson(e)).toList() as M;
  452. }
  453. if (<RewardsActiveDetailData>[] is M) {
  454. return data.map<RewardsActiveDetailData>((Map<String, dynamic> e) =>
  455. RewardsActiveDetailData.fromJson(e)).toList() as M;
  456. }
  457. if (<RewardsActiveDetailDataAccount>[] is M) {
  458. return data.map<RewardsActiveDetailDataAccount>((
  459. Map<String, dynamic> e) => RewardsActiveDetailDataAccount.fromJson(e))
  460. .toList() as M;
  461. }
  462. if (<RewardsActiveDetailDataReward>[] is M) {
  463. return data.map<RewardsActiveDetailDataReward>((Map<String, dynamic> e) =>
  464. RewardsActiveDetailDataReward.fromJson(e)).toList() as M;
  465. }
  466. if (<RewardsBuyEntity>[] is M) {
  467. return data.map<RewardsBuyEntity>((Map<String, dynamic> e) =>
  468. RewardsBuyEntity.fromJson(e)).toList() as M;
  469. }
  470. if (<RewardsBuyReward>[] is M) {
  471. return data.map<RewardsBuyReward>((Map<String, dynamic> e) =>
  472. RewardsBuyReward.fromJson(e)).toList() as M;
  473. }
  474. if (<RewardsBuyRewardRedeemable>[] is M) {
  475. return data.map<RewardsBuyRewardRedeemable>((Map<String, dynamic> e) =>
  476. RewardsBuyRewardRedeemable.fromJson(e)).toList() as M;
  477. }
  478. if (<RewardsCategoryEntity>[] is M) {
  479. return data.map<RewardsCategoryEntity>((Map<String, dynamic> e) =>
  480. RewardsCategoryEntity.fromJson(e)).toList() as M;
  481. }
  482. if (<RewardsDetailEntity>[] is M) {
  483. return data.map<RewardsDetailEntity>((Map<String, dynamic> e) =>
  484. RewardsDetailEntity.fromJson(e)).toList() as M;
  485. }
  486. if (<RewardsDetailRedeemable>[] is M) {
  487. return data.map<RewardsDetailRedeemable>((Map<String, dynamic> e) =>
  488. RewardsDetailRedeemable.fromJson(e)).toList() as M;
  489. }
  490. if (<RewardsHistoryEarnedEntity>[] is M) {
  491. return data.map<RewardsHistoryEarnedEntity>((Map<String, dynamic> e) =>
  492. RewardsHistoryEarnedEntity.fromJson(e)).toList() as M;
  493. }
  494. if (<RewardsHistoryEarnedList>[] is M) {
  495. return data.map<RewardsHistoryEarnedList>((Map<String, dynamic> e) =>
  496. RewardsHistoryEarnedList.fromJson(e)).toList() as M;
  497. }
  498. if (<RewardsHomeEntity>[] is M) {
  499. return data.map<RewardsHomeEntity>((Map<String, dynamic> e) =>
  500. RewardsHomeEntity.fromJson(e)).toList() as M;
  501. }
  502. if (<RewardsHomeData>[] is M) {
  503. return data.map<RewardsHomeData>((Map<String, dynamic> e) =>
  504. RewardsHomeData.fromJson(e)).toList() as M;
  505. }
  506. if (<RewardsHomeDataRewards>[] is M) {
  507. return data.map<RewardsHomeDataRewards>((Map<String, dynamic> e) =>
  508. RewardsHomeDataRewards.fromJson(e)).toList() as M;
  509. }
  510. if (<RewardsHomeTesEntity>[] is M) {
  511. return data.map<RewardsHomeTesEntity>((Map<String, dynamic> e) =>
  512. RewardsHomeTesEntity.fromJson(e)).toList() as M;
  513. }
  514. if (<RewardsHomeTesRewards>[] is M) {
  515. return data.map<RewardsHomeTesRewards>((Map<String, dynamic> e) =>
  516. RewardsHomeTesRewards.fromJson(e)).toList() as M;
  517. }
  518. if (<RewardsHomeTestEntity>[] is M) {
  519. return data.map<RewardsHomeTestEntity>((Map<String, dynamic> e) =>
  520. RewardsHomeTestEntity.fromJson(e)).toList() as M;
  521. }
  522. if (<RewardsHomeTxEntity>[] is M) {
  523. return data.map<RewardsHomeTxEntity>((Map<String, dynamic> e) =>
  524. RewardsHomeTxEntity.fromJson(e)).toList() as M;
  525. }
  526. if (<RewardsIndexEntity>[] is M) {
  527. return data.map<RewardsIndexEntity>((Map<String, dynamic> e) =>
  528. RewardsIndexEntity.fromJson(e)).toList() as M;
  529. }
  530. if (<RewardsIndexContinuous>[] is M) {
  531. return data.map<RewardsIndexContinuous>((Map<String, dynamic> e) =>
  532. RewardsIndexContinuous.fromJson(e)).toList() as M;
  533. }
  534. if (<RewardsIndexTasks>[] is M) {
  535. return data.map<RewardsIndexTasks>((Map<String, dynamic> e) =>
  536. RewardsIndexTasks.fromJson(e)).toList() as M;
  537. }
  538. if (<RewardsListEntity>[] is M) {
  539. return data.map<RewardsListEntity>((Map<String, dynamic> e) =>
  540. RewardsListEntity.fromJson(e)).toList() as M;
  541. }
  542. if (<RewardsListList>[] is M) {
  543. return data.map<RewardsListList>((Map<String, dynamic> e) =>
  544. RewardsListList.fromJson(e)).toList() as M;
  545. }
  546. if (<RewardsMyDetailEntity>[] is M) {
  547. return data.map<RewardsMyDetailEntity>((Map<String, dynamic> e) =>
  548. RewardsMyDetailEntity.fromJson(e)).toList() as M;
  549. }
  550. if (<RewardsMyDetailAccount>[] is M) {
  551. return data.map<RewardsMyDetailAccount>((Map<String, dynamic> e) =>
  552. RewardsMyDetailAccount.fromJson(e)).toList() as M;
  553. }
  554. if (<RewardsMyDetailReward>[] is M) {
  555. return data.map<RewardsMyDetailReward>((Map<String, dynamic> e) =>
  556. RewardsMyDetailReward.fromJson(e)).toList() as M;
  557. }
  558. if (<RewardsMyEntity>[] is M) {
  559. return data.map<RewardsMyEntity>((Map<String, dynamic> e) =>
  560. RewardsMyEntity.fromJson(e)).toList() as M;
  561. }
  562. if (<RewardsMyList>[] is M) {
  563. return data.map<RewardsMyList>((Map<String, dynamic> e) =>
  564. RewardsMyList.fromJson(e)).toList() as M;
  565. }
  566. if (<RewardsMyListReward>[] is M) {
  567. return data.map<RewardsMyListReward>((Map<String, dynamic> e) =>
  568. RewardsMyListReward.fromJson(e)).toList() as M;
  569. }
  570. if (<RewardsSearchEntity>[] is M) {
  571. return data.map<RewardsSearchEntity>((Map<String, dynamic> e) =>
  572. RewardsSearchEntity.fromJson(e)).toList() as M;
  573. }
  574. if (<RewardsSearchRewards>[] is M) {
  575. return data.map<RewardsSearchRewards>((Map<String, dynamic> e) =>
  576. RewardsSearchRewards.fromJson(e)).toList() as M;
  577. }
  578. if (<ServerTime>[] is M) {
  579. return data.map<ServerTime>((Map<String, dynamic> e) =>
  580. ServerTime.fromJson(e)).toList() as M;
  581. }
  582. if (<TextKonEntity>[] is M) {
  583. return data.map<TextKonEntity>((Map<String, dynamic> e) =>
  584. TextKonEntity.fromJson(e)).toList() as M;
  585. }
  586. if (<UserMeEntity>[] is M) {
  587. return data.map<UserMeEntity>((Map<String, dynamic> e) =>
  588. UserMeEntity.fromJson(e)).toList() as M;
  589. }
  590. if (<UserMeHouseholds>[] is M) {
  591. return data.map<UserMeHouseholds>((Map<String, dynamic> e) =>
  592. UserMeHouseholds.fromJson(e)).toList() as M;
  593. }
  594. if (<UserMeEstates>[] is M) {
  595. return data.map<UserMeEstates>((Map<String, dynamic> e) =>
  596. UserMeEstates.fromJson(e)).toList() as M;
  597. }
  598. if (<UserMeEstatesAccounts>[] is M) {
  599. return data.map<UserMeEstatesAccounts>((Map<String, dynamic> e) =>
  600. UserMeEstatesAccounts.fromJson(e)).toList() as M;
  601. }
  602. if (<UserMeEstatesAccountsUnit>[] is M) {
  603. return data.map<UserMeEstatesAccountsUnit>((Map<String, dynamic> e) =>
  604. UserMeEstatesAccountsUnit.fromJson(e)).toList() as M;
  605. }
  606. if (<UserMeDefaultUnit>[] is M) {
  607. return data.map<UserMeDefaultUnit>((Map<String, dynamic> e) =>
  608. UserMeDefaultUnit.fromJson(e)).toList() as M;
  609. }
  610. if (<UserMeInformation>[] is M) {
  611. return data.map<UserMeInformation>((Map<String, dynamic> e) =>
  612. UserMeInformation.fromJson(e)).toList() as M;
  613. }
  614. if (<VisitorPageEntity>[] is M) {
  615. return data.map<VisitorPageEntity>((Map<String, dynamic> e) =>
  616. VisitorPageEntity.fromJson(e)).toList() as M;
  617. }
  618. if (<VisitorPageList>[] is M) {
  619. return data.map<VisitorPageList>((Map<String, dynamic> e) =>
  620. VisitorPageList.fromJson(e)).toList() as M;
  621. }
  622. debugPrint("$M not found");
  623. return null;
  624. }
  625. static M? fromJsonAsT<M>(dynamic json) {
  626. if (json is M) {
  627. return json;
  628. }
  629. if (json is List) {
  630. return _getListChildType<M>(
  631. json.map((dynamic e) => e as Map<String, dynamic>).toList());
  632. } else {
  633. return jsonConvert.convert<M>(json);
  634. }
  635. }
  636. }
  637. class JsonConvertClassCollection {
  638. Map<String, JsonConvertFunction> convertFuncMap = {
  639. (AuthLoginEntity).toString(): AuthLoginEntity.fromJson,
  640. (CaptchaImgEntity).toString(): CaptchaImgEntity.fromJson,
  641. (FacilityBookEntity).toString(): FacilityBookEntity.fromJson,
  642. (FacilityBookFacilityType).toString(): FacilityBookFacilityType.fromJson,
  643. (FacilityBookFacilities).toString(): FacilityBookFacilities.fromJson,
  644. (FacilityBookFacilitiesPeriods).toString(): FacilityBookFacilitiesPeriods
  645. .fromJson,
  646. (FacilityIndexEntity).toString(): FacilityIndexEntity.fromJson,
  647. (FacilityPageEntity).toString(): FacilityPageEntity.fromJson,
  648. (FacilityDetail).toString(): FacilityDetail.fromJson,
  649. (FacilityPageListBooking).toString(): FacilityPageListBooking.fromJson,
  650. (FacilityPageListFacility).toString(): FacilityPageListFacility.fromJson,
  651. (FacilityPageListFacilityType).toString(): FacilityPageListFacilityType
  652. .fromJson,
  653. (FacilityPageListTimePeriod).toString(): FacilityPageListTimePeriod
  654. .fromJson,
  655. (FacilityPageListAccount).toString(): FacilityPageListAccount.fromJson,
  656. (FeedbackDetailEntity).toString(): FeedbackDetailEntity.fromJson,
  657. (FeedbackDetailReplies).toString(): FeedbackDetailReplies.fromJson,
  658. (FeedbackListEntity).toString(): FeedbackListEntity.fromJson,
  659. (FeedbackItemEntity).toString(): FeedbackItemEntity.fromJson,
  660. (FormContentEntity).toString(): FormContentEntity.fromJson,
  661. (FormDetailEntity).toString(): FormDetailEntity.fromJson,
  662. (FormListEntity).toString(): FormListEntity.fromJson,
  663. (FormOptionEntity).toString(): FormOptionEntity.fromJson,
  664. (FormSubmittedEntity).toString(): FormSubmittedEntity.fromJson,
  665. (FormSubmittedEstateOnlineForm).toString(): FormSubmittedEstateOnlineForm
  666. .fromJson,
  667. (FormSubmittedPageEntity).toString(): FormSubmittedPageEntity.fromJson,
  668. (GarageSaleRentDetailEntity).toString(): GarageSaleRentDetailEntity
  669. .fromJson,
  670. (GarageSaleRentDetailAccount).toString(): GarageSaleRentDetailAccount
  671. .fromJson,
  672. (GarageSaleRentEntity).toString(): GarageSaleRentEntity.fromJson,
  673. (GarageSaleRentList).toString(): GarageSaleRentList.fromJson,
  674. (GarageSaleRentListAccount).toString(): GarageSaleRentListAccount.fromJson,
  675. (IdNameEntity).toString(): IdNameEntity.fromJson,
  676. (MyfollowingListEntity).toString(): MyfollowingListEntity.fromJson,
  677. (MypostsNewsfeedEntity).toString(): MypostsNewsfeedEntity.fromJson,
  678. (MypostsNewsfeedList).toString(): MypostsNewsfeedList.fromJson,
  679. (MypostsNewsfeedListAccount).toString(): MypostsNewsfeedListAccount
  680. .fromJson,
  681. (MypostsSaleRentEntity).toString(): MypostsSaleRentEntity.fromJson,
  682. (MypostsSaleRentList).toString(): MypostsSaleRentList.fromJson,
  683. (NewsfeedCommentPublishEntity).toString(): NewsfeedCommentPublishEntity
  684. .fromJson,
  685. (NewsfeedDetailEntity).toString(): NewsfeedDetailEntity.fromJson,
  686. (NewsfeedDetailAccount).toString(): NewsfeedDetailAccount.fromJson,
  687. (NewsfeedDetailComments).toString(): NewsfeedDetailComments.fromJson,
  688. (NewsfeedDetailCommentsAccount).toString(): NewsfeedDetailCommentsAccount
  689. .fromJson,
  690. (NewsfeedDetailCommentsToAccount)
  691. .toString(): NewsfeedDetailCommentsToAccount.fromJson,
  692. (NewsfeedFollowingEntity).toString(): NewsfeedFollowingEntity.fromJson,
  693. (NewsfeedFollowingList).toString(): NewsfeedFollowingList.fromJson,
  694. (NewsfeedFollowingListAccount).toString(): NewsfeedFollowingListAccount
  695. .fromJson,
  696. (NewsfeedForyouEntity).toString(): NewsfeedForyouEntity.fromJson,
  697. (NewsfeedForyouList).toString(): NewsfeedForyouList.fromJson,
  698. (NewsfeedForyouListAccount).toString(): NewsfeedForyouListAccount.fromJson,
  699. (NewsfeedNewsEntity).toString(): NewsfeedNewsEntity.fromJson,
  700. (NewsfeedNewsList).toString(): NewsfeedNewsList.fromJson,
  701. (NewsfeedNewsListAccount).toString(): NewsfeedNewsListAccount.fromJson,
  702. (NoticeBoardAnnounDetailEntity).toString(): NoticeBoardAnnounDetailEntity
  703. .fromJson,
  704. (NoticeBoardAnnounEntity).toString(): NoticeBoardAnnounEntity.fromJson,
  705. (NoticeBoardAnnounList).toString(): NoticeBoardAnnounList.fromJson,
  706. (NoticeBoardDocumentsEntity).toString(): NoticeBoardDocumentsEntity
  707. .fromJson,
  708. (NoticeBoardDocumentsList).toString(): NoticeBoardDocumentsList.fromJson,
  709. (NoticeBoardEventDetailEntity).toString(): NoticeBoardEventDetailEntity
  710. .fromJson,
  711. (NoticeBoardEventEntity).toString(): NoticeBoardEventEntity.fromJson,
  712. (NoticeBoardEventList).toString(): NoticeBoardEventList.fromJson,
  713. (PaymentPageEntity).toString(): PaymentPageEntity.fromJson,
  714. (PaymentPageList).toString(): PaymentPageList.fromJson,
  715. (PropertyNewsEntity).toString(): PropertyNewsEntity.fromJson,
  716. (PropertyNewsList).toString(): PropertyNewsList.fromJson,
  717. (PropertySaleRentEntity).toString(): PropertySaleRentEntity.fromJson,
  718. (PropertySaleRentList).toString(): PropertySaleRentList.fromJson,
  719. (RewardsActiveDetailEntity).toString(): RewardsActiveDetailEntity.fromJson,
  720. (RewardsActiveDetailData).toString(): RewardsActiveDetailData.fromJson,
  721. (RewardsActiveDetailDataAccount).toString(): RewardsActiveDetailDataAccount
  722. .fromJson,
  723. (RewardsActiveDetailDataReward).toString(): RewardsActiveDetailDataReward
  724. .fromJson,
  725. (RewardsBuyEntity).toString(): RewardsBuyEntity.fromJson,
  726. (RewardsBuyReward).toString(): RewardsBuyReward.fromJson,
  727. (RewardsBuyRewardRedeemable).toString(): RewardsBuyRewardRedeemable
  728. .fromJson,
  729. (RewardsCategoryEntity).toString(): RewardsCategoryEntity.fromJson,
  730. (RewardsDetailEntity).toString(): RewardsDetailEntity.fromJson,
  731. (RewardsDetailRedeemable).toString(): RewardsDetailRedeemable.fromJson,
  732. (RewardsHistoryEarnedEntity).toString(): RewardsHistoryEarnedEntity
  733. .fromJson,
  734. (RewardsHistoryEarnedList).toString(): RewardsHistoryEarnedList.fromJson,
  735. (RewardsHomeEntity).toString(): RewardsHomeEntity.fromJson,
  736. (RewardsHomeData).toString(): RewardsHomeData.fromJson,
  737. (RewardsHomeDataRewards).toString(): RewardsHomeDataRewards.fromJson,
  738. (RewardsHomeTesEntity).toString(): RewardsHomeTesEntity.fromJson,
  739. (RewardsHomeTesRewards).toString(): RewardsHomeTesRewards.fromJson,
  740. (RewardsHomeTestEntity).toString(): RewardsHomeTestEntity.fromJson,
  741. (RewardsHomeTxEntity).toString(): RewardsHomeTxEntity.fromJson,
  742. (RewardsIndexEntity).toString(): RewardsIndexEntity.fromJson,
  743. (RewardsIndexContinuous).toString(): RewardsIndexContinuous.fromJson,
  744. (RewardsIndexTasks).toString(): RewardsIndexTasks.fromJson,
  745. (RewardsListEntity).toString(): RewardsListEntity.fromJson,
  746. (RewardsListList).toString(): RewardsListList.fromJson,
  747. (RewardsMyDetailEntity).toString(): RewardsMyDetailEntity.fromJson,
  748. (RewardsMyDetailAccount).toString(): RewardsMyDetailAccount.fromJson,
  749. (RewardsMyDetailReward).toString(): RewardsMyDetailReward.fromJson,
  750. (RewardsMyEntity).toString(): RewardsMyEntity.fromJson,
  751. (RewardsMyList).toString(): RewardsMyList.fromJson,
  752. (RewardsMyListReward).toString(): RewardsMyListReward.fromJson,
  753. (RewardsSearchEntity).toString(): RewardsSearchEntity.fromJson,
  754. (RewardsSearchRewards).toString(): RewardsSearchRewards.fromJson,
  755. (ServerTime).toString(): ServerTime.fromJson,
  756. (TextKonEntity).toString(): TextKonEntity.fromJson,
  757. (UserMeEntity).toString(): UserMeEntity.fromJson,
  758. (UserMeHouseholds).toString(): UserMeHouseholds.fromJson,
  759. (UserMeEstates).toString(): UserMeEstates.fromJson,
  760. (UserMeEstatesAccounts).toString(): UserMeEstatesAccounts.fromJson,
  761. (UserMeEstatesAccountsUnit).toString(): UserMeEstatesAccountsUnit.fromJson,
  762. (UserMeDefaultUnit).toString(): UserMeDefaultUnit.fromJson,
  763. (UserMeInformation).toString(): UserMeInformation.fromJson,
  764. (VisitorPageEntity).toString(): VisitorPageEntity.fromJson,
  765. (VisitorPageList).toString(): VisitorPageList.fromJson,
  766. };
  767. bool containsKey(String type) {
  768. return convertFuncMap.containsKey(type);
  769. }
  770. JsonConvertFunction? operator [](String key) {
  771. return convertFuncMap[key];
  772. }
  773. }