json_convert_content.dart 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  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_entity.dart';
  31. import 'package:domain/entity/notice_board_documents_entity.dart';
  32. import 'package:domain/entity/notice_board_event_entity.dart';
  33. import 'package:domain/entity/payment_page_entity.dart';
  34. import 'package:domain/entity/property_news_entity.dart';
  35. import 'package:domain/entity/property_sale_rent_entity.dart';
  36. import 'package:domain/entity/rewards_category_entity.dart';
  37. import 'package:domain/entity/rewards_history_earned_entity.dart';
  38. import 'package:domain/entity/rewards_home_entity.dart';
  39. import 'package:domain/entity/rewards_home_tes_entity.dart';
  40. import 'package:domain/entity/rewards_home_test_entity.dart';
  41. import 'package:domain/entity/rewards_home_tx_entity.dart';
  42. import 'package:domain/entity/rewards_index_entity.dart';
  43. import 'package:domain/entity/rewards_list_entity.dart';
  44. import 'package:domain/entity/server_time.dart';
  45. import 'package:domain/entity/text_kon_entity.dart';
  46. import 'package:domain/entity/user_me_entity.dart';
  47. import 'package:domain/entity/visitor_page_entity.dart';
  48. JsonConvert jsonConvert = JsonConvert();
  49. typedef JsonConvertFunction<T> = T Function(Map<String, dynamic> json);
  50. typedef EnumConvertFunction<T> = T Function(String value);
  51. typedef ConvertExceptionHandler = void Function(Object error, StackTrace stackTrace);
  52. extension MapSafeExt<K, V> on Map<K, V> {
  53. T? getOrNull<T>(K? key) {
  54. if (!containsKey(key) || key == null) {
  55. return null;
  56. } else {
  57. return this[key] as T?;
  58. }
  59. }
  60. }
  61. class JsonConvert {
  62. static ConvertExceptionHandler? onError;
  63. JsonConvertClassCollection convertFuncMap = JsonConvertClassCollection();
  64. /// 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
  65. /// https://flutter.cn/docs/development/tools/hot-reload
  66. /// class MyApp extends StatelessWidget {
  67. /// const MyApp({Key? key})
  68. /// : super(key: key);
  69. ///
  70. /// @override
  71. /// Widget build(BuildContext context) {
  72. /// jsonConvert.reassembleConvertFuncMap();
  73. /// return MaterialApp();
  74. /// }
  75. /// }
  76. void reassembleConvertFuncMap() {
  77. bool isReleaseMode = const bool.fromEnvironment('dart.vm.product');
  78. if (!isReleaseMode) {
  79. convertFuncMap = JsonConvertClassCollection();
  80. }
  81. }
  82. T? convert<T>(dynamic value, {EnumConvertFunction? enumConvert}) {
  83. if (value == null) {
  84. return null;
  85. }
  86. if (value is T) {
  87. return value;
  88. }
  89. try {
  90. return _asT<T>(value, enumConvert: enumConvert);
  91. } catch (e, stackTrace) {
  92. debugPrint('asT<$T> $e $stackTrace');
  93. if (onError != null) {
  94. onError!(e, stackTrace);
  95. }
  96. return null;
  97. }
  98. }
  99. List<T?>? convertList<T>(List<dynamic>? value,
  100. {EnumConvertFunction? enumConvert}) {
  101. if (value == null) {
  102. return null;
  103. }
  104. try {
  105. return value.map((dynamic e) => _asT<T>(e, enumConvert: enumConvert))
  106. .toList();
  107. } catch (e, stackTrace) {
  108. debugPrint('asT<$T> $e $stackTrace');
  109. if (onError != null) {
  110. onError!(e, stackTrace);
  111. }
  112. return <T>[];
  113. }
  114. }
  115. List<T>? convertListNotNull<T>(dynamic value,
  116. {EnumConvertFunction? enumConvert}) {
  117. if (value == null) {
  118. return null;
  119. }
  120. try {
  121. return (value as List<dynamic>).map((dynamic e) =>
  122. _asT<T>(e, enumConvert: enumConvert)!).toList();
  123. } catch (e, stackTrace) {
  124. debugPrint('asT<$T> $e $stackTrace');
  125. if (onError != null) {
  126. onError!(e, stackTrace);
  127. }
  128. return <T>[];
  129. }
  130. }
  131. T? _asT<T extends Object?>(dynamic value,
  132. {EnumConvertFunction? enumConvert}) {
  133. final String type = T.toString();
  134. final String valueS = value.toString();
  135. if (enumConvert != null) {
  136. return enumConvert(valueS) as T;
  137. } else if (type == "String") {
  138. return valueS as T;
  139. } else if (type == "int") {
  140. final int? intValue = int.tryParse(valueS);
  141. if (intValue == null) {
  142. return double.tryParse(valueS)?.toInt() as T?;
  143. } else {
  144. return intValue as T;
  145. }
  146. } else if (type == "double") {
  147. return double.parse(valueS) as T;
  148. } else if (type == "DateTime") {
  149. return DateTime.parse(valueS) as T;
  150. } else if (type == "bool") {
  151. if (valueS == '0' || valueS == '1') {
  152. return (valueS == '1') as T;
  153. }
  154. return (valueS == 'true') as T;
  155. } else if (type == "Map" || type.startsWith("Map<")) {
  156. return value as T;
  157. } else {
  158. if (convertFuncMap.containsKey(type)) {
  159. if (value == null) {
  160. return null;
  161. }
  162. var covertFunc = convertFuncMap[type]!;
  163. if (covertFunc is Map<String, dynamic>) {
  164. return covertFunc(value as Map<String, dynamic>) as T;
  165. } else {
  166. return covertFunc(Map<String, dynamic>.from(value)) as T;
  167. }
  168. } else {
  169. throw UnimplementedError(
  170. '$type unimplemented,you can try running the app again');
  171. }
  172. }
  173. }
  174. //list is returned by type
  175. static M? _getListChildType<M>(List<Map<String, dynamic>> data) {
  176. if (<AuthLoginEntity>[] is M) {
  177. return data.map<AuthLoginEntity>((Map<String, dynamic> e) =>
  178. AuthLoginEntity.fromJson(e)).toList() as M;
  179. }
  180. if (<CaptchaImgEntity>[] is M) {
  181. return data.map<CaptchaImgEntity>((Map<String, dynamic> e) =>
  182. CaptchaImgEntity.fromJson(e)).toList() as M;
  183. }
  184. if (<FacilityBookEntity>[] is M) {
  185. return data.map<FacilityBookEntity>((Map<String, dynamic> e) =>
  186. FacilityBookEntity.fromJson(e)).toList() as M;
  187. }
  188. if (<FacilityBookFacilityType>[] is M) {
  189. return data.map<FacilityBookFacilityType>((Map<String, dynamic> e) =>
  190. FacilityBookFacilityType.fromJson(e)).toList() as M;
  191. }
  192. if (<FacilityBookFacilities>[] is M) {
  193. return data.map<FacilityBookFacilities>((Map<String, dynamic> e) =>
  194. FacilityBookFacilities.fromJson(e)).toList() as M;
  195. }
  196. if (<FacilityBookFacilitiesPeriods>[] is M) {
  197. return data.map<FacilityBookFacilitiesPeriods>((Map<String, dynamic> e) =>
  198. FacilityBookFacilitiesPeriods.fromJson(e)).toList() as M;
  199. }
  200. if (<FacilityIndexEntity>[] is M) {
  201. return data.map<FacilityIndexEntity>((Map<String, dynamic> e) =>
  202. FacilityIndexEntity.fromJson(e)).toList() as M;
  203. }
  204. if (<FacilityPageEntity>[] is M) {
  205. return data.map<FacilityPageEntity>((Map<String, dynamic> e) =>
  206. FacilityPageEntity.fromJson(e)).toList() as M;
  207. }
  208. if (<FacilityDetail>[] is M) {
  209. return data.map<FacilityDetail>((Map<String, dynamic> e) =>
  210. FacilityDetail.fromJson(e)).toList() as M;
  211. }
  212. if (<FacilityPageListBooking>[] is M) {
  213. return data.map<FacilityPageListBooking>((Map<String, dynamic> e) =>
  214. FacilityPageListBooking.fromJson(e)).toList() as M;
  215. }
  216. if (<FacilityPageListFacility>[] is M) {
  217. return data.map<FacilityPageListFacility>((Map<String, dynamic> e) =>
  218. FacilityPageListFacility.fromJson(e)).toList() as M;
  219. }
  220. if (<FacilityPageListFacilityType>[] is M) {
  221. return data.map<FacilityPageListFacilityType>((Map<String, dynamic> e) =>
  222. FacilityPageListFacilityType.fromJson(e)).toList() as M;
  223. }
  224. if (<FacilityPageListTimePeriod>[] is M) {
  225. return data.map<FacilityPageListTimePeriod>((Map<String, dynamic> e) =>
  226. FacilityPageListTimePeriod.fromJson(e)).toList() as M;
  227. }
  228. if (<FacilityPageListAccount>[] is M) {
  229. return data.map<FacilityPageListAccount>((Map<String, dynamic> e) =>
  230. FacilityPageListAccount.fromJson(e)).toList() as M;
  231. }
  232. if (<FeedbackDetailEntity>[] is M) {
  233. return data.map<FeedbackDetailEntity>((Map<String, dynamic> e) =>
  234. FeedbackDetailEntity.fromJson(e)).toList() as M;
  235. }
  236. if (<FeedbackDetailReplies>[] is M) {
  237. return data.map<FeedbackDetailReplies>((Map<String, dynamic> e) =>
  238. FeedbackDetailReplies.fromJson(e)).toList() as M;
  239. }
  240. if (<FeedbackListEntity>[] is M) {
  241. return data.map<FeedbackListEntity>((Map<String, dynamic> e) =>
  242. FeedbackListEntity.fromJson(e)).toList() as M;
  243. }
  244. if (<FeedbackItemEntity>[] is M) {
  245. return data.map<FeedbackItemEntity>((Map<String, dynamic> e) =>
  246. FeedbackItemEntity.fromJson(e)).toList() as M;
  247. }
  248. if (<FormContentEntity>[] is M) {
  249. return data.map<FormContentEntity>((Map<String, dynamic> e) =>
  250. FormContentEntity.fromJson(e)).toList() as M;
  251. }
  252. if (<FormDetailEntity>[] is M) {
  253. return data.map<FormDetailEntity>((Map<String, dynamic> e) =>
  254. FormDetailEntity.fromJson(e)).toList() as M;
  255. }
  256. if (<FormListEntity>[] is M) {
  257. return data.map<FormListEntity>((Map<String, dynamic> e) =>
  258. FormListEntity.fromJson(e)).toList() as M;
  259. }
  260. if (<FormOptionEntity>[] is M) {
  261. return data.map<FormOptionEntity>((Map<String, dynamic> e) =>
  262. FormOptionEntity.fromJson(e)).toList() as M;
  263. }
  264. if (<FormSubmittedEntity>[] is M) {
  265. return data.map<FormSubmittedEntity>((Map<String, dynamic> e) =>
  266. FormSubmittedEntity.fromJson(e)).toList() as M;
  267. }
  268. if (<FormSubmittedEstateOnlineForm>[] is M) {
  269. return data.map<FormSubmittedEstateOnlineForm>((Map<String, dynamic> e) =>
  270. FormSubmittedEstateOnlineForm.fromJson(e)).toList() as M;
  271. }
  272. if (<FormSubmittedPageEntity>[] is M) {
  273. return data.map<FormSubmittedPageEntity>((Map<String, dynamic> e) =>
  274. FormSubmittedPageEntity.fromJson(e)).toList() as M;
  275. }
  276. if (<GarageSaleRentDetailEntity>[] is M) {
  277. return data.map<GarageSaleRentDetailEntity>((Map<String, dynamic> e) =>
  278. GarageSaleRentDetailEntity.fromJson(e)).toList() as M;
  279. }
  280. if (<GarageSaleRentDetailAccount>[] is M) {
  281. return data.map<GarageSaleRentDetailAccount>((Map<String, dynamic> e) =>
  282. GarageSaleRentDetailAccount.fromJson(e)).toList() as M;
  283. }
  284. if (<GarageSaleRentEntity>[] is M) {
  285. return data.map<GarageSaleRentEntity>((Map<String, dynamic> e) =>
  286. GarageSaleRentEntity.fromJson(e)).toList() as M;
  287. }
  288. if (<GarageSaleRentList>[] is M) {
  289. return data.map<GarageSaleRentList>((Map<String, dynamic> e) =>
  290. GarageSaleRentList.fromJson(e)).toList() as M;
  291. }
  292. if (<GarageSaleRentListAccount>[] is M) {
  293. return data.map<GarageSaleRentListAccount>((Map<String, dynamic> e) =>
  294. GarageSaleRentListAccount.fromJson(e)).toList() as M;
  295. }
  296. if (<IdNameEntity>[] is M) {
  297. return data.map<IdNameEntity>((Map<String, dynamic> e) =>
  298. IdNameEntity.fromJson(e)).toList() as M;
  299. }
  300. if (<MyfollowingListEntity>[] is M) {
  301. return data.map<MyfollowingListEntity>((Map<String, dynamic> e) =>
  302. MyfollowingListEntity.fromJson(e)).toList() as M;
  303. }
  304. if (<MypostsNewsfeedEntity>[] is M) {
  305. return data.map<MypostsNewsfeedEntity>((Map<String, dynamic> e) =>
  306. MypostsNewsfeedEntity.fromJson(e)).toList() as M;
  307. }
  308. if (<MypostsNewsfeedList>[] is M) {
  309. return data.map<MypostsNewsfeedList>((Map<String, dynamic> e) =>
  310. MypostsNewsfeedList.fromJson(e)).toList() as M;
  311. }
  312. if (<MypostsNewsfeedListAccount>[] is M) {
  313. return data.map<MypostsNewsfeedListAccount>((Map<String, dynamic> e) =>
  314. MypostsNewsfeedListAccount.fromJson(e)).toList() as M;
  315. }
  316. if (<MypostsSaleRentEntity>[] is M) {
  317. return data.map<MypostsSaleRentEntity>((Map<String, dynamic> e) =>
  318. MypostsSaleRentEntity.fromJson(e)).toList() as M;
  319. }
  320. if (<MypostsSaleRentList>[] is M) {
  321. return data.map<MypostsSaleRentList>((Map<String, dynamic> e) =>
  322. MypostsSaleRentList.fromJson(e)).toList() as M;
  323. }
  324. if (<NewsfeedCommentPublishEntity>[] is M) {
  325. return data.map<NewsfeedCommentPublishEntity>((Map<String, dynamic> e) =>
  326. NewsfeedCommentPublishEntity.fromJson(e)).toList() as M;
  327. }
  328. if (<NewsfeedDetailEntity>[] is M) {
  329. return data.map<NewsfeedDetailEntity>((Map<String, dynamic> e) =>
  330. NewsfeedDetailEntity.fromJson(e)).toList() as M;
  331. }
  332. if (<NewsfeedDetailAccount>[] is M) {
  333. return data.map<NewsfeedDetailAccount>((Map<String, dynamic> e) =>
  334. NewsfeedDetailAccount.fromJson(e)).toList() as M;
  335. }
  336. if (<NewsfeedDetailComments>[] is M) {
  337. return data.map<NewsfeedDetailComments>((Map<String, dynamic> e) =>
  338. NewsfeedDetailComments.fromJson(e)).toList() as M;
  339. }
  340. if (<NewsfeedDetailCommentsAccount>[] is M) {
  341. return data.map<NewsfeedDetailCommentsAccount>((Map<String, dynamic> e) =>
  342. NewsfeedDetailCommentsAccount.fromJson(e)).toList() as M;
  343. }
  344. if (<NewsfeedDetailCommentsToAccount>[] is M) {
  345. return data.map<NewsfeedDetailCommentsToAccount>((
  346. Map<String, dynamic> e) =>
  347. NewsfeedDetailCommentsToAccount.fromJson(e)).toList() as M;
  348. }
  349. if (<NewsfeedFollowingEntity>[] is M) {
  350. return data.map<NewsfeedFollowingEntity>((Map<String, dynamic> e) =>
  351. NewsfeedFollowingEntity.fromJson(e)).toList() as M;
  352. }
  353. if (<NewsfeedFollowingList>[] is M) {
  354. return data.map<NewsfeedFollowingList>((Map<String, dynamic> e) =>
  355. NewsfeedFollowingList.fromJson(e)).toList() as M;
  356. }
  357. if (<NewsfeedFollowingListAccount>[] is M) {
  358. return data.map<NewsfeedFollowingListAccount>((Map<String, dynamic> e) =>
  359. NewsfeedFollowingListAccount.fromJson(e)).toList() as M;
  360. }
  361. if (<NewsfeedForyouEntity>[] is M) {
  362. return data.map<NewsfeedForyouEntity>((Map<String, dynamic> e) =>
  363. NewsfeedForyouEntity.fromJson(e)).toList() as M;
  364. }
  365. if (<NewsfeedForyouList>[] is M) {
  366. return data.map<NewsfeedForyouList>((Map<String, dynamic> e) =>
  367. NewsfeedForyouList.fromJson(e)).toList() as M;
  368. }
  369. if (<NewsfeedForyouListAccount>[] is M) {
  370. return data.map<NewsfeedForyouListAccount>((Map<String, dynamic> e) =>
  371. NewsfeedForyouListAccount.fromJson(e)).toList() as M;
  372. }
  373. if (<NewsfeedNewsEntity>[] is M) {
  374. return data.map<NewsfeedNewsEntity>((Map<String, dynamic> e) =>
  375. NewsfeedNewsEntity.fromJson(e)).toList() as M;
  376. }
  377. if (<NewsfeedNewsList>[] is M) {
  378. return data.map<NewsfeedNewsList>((Map<String, dynamic> e) =>
  379. NewsfeedNewsList.fromJson(e)).toList() as M;
  380. }
  381. if (<NewsfeedNewsListAccount>[] is M) {
  382. return data.map<NewsfeedNewsListAccount>((Map<String, dynamic> e) =>
  383. NewsfeedNewsListAccount.fromJson(e)).toList() as M;
  384. }
  385. if (<NoticeBoardAnnounEntity>[] is M) {
  386. return data.map<NoticeBoardAnnounEntity>((Map<String, dynamic> e) =>
  387. NoticeBoardAnnounEntity.fromJson(e)).toList() as M;
  388. }
  389. if (<NoticeBoardDocumentsEntity>[] is M) {
  390. return data.map<NoticeBoardDocumentsEntity>((Map<String, dynamic> e) =>
  391. NoticeBoardDocumentsEntity.fromJson(e)).toList() as M;
  392. }
  393. if (<NoticeBoardEventEntity>[] is M) {
  394. return data.map<NoticeBoardEventEntity>((Map<String, dynamic> e) =>
  395. NoticeBoardEventEntity.fromJson(e)).toList() as M;
  396. }
  397. if (<PaymentPageEntity>[] is M) {
  398. return data.map<PaymentPageEntity>((Map<String, dynamic> e) =>
  399. PaymentPageEntity.fromJson(e)).toList() as M;
  400. }
  401. if (<PaymentPageList>[] is M) {
  402. return data.map<PaymentPageList>((Map<String, dynamic> e) =>
  403. PaymentPageList.fromJson(e)).toList() as M;
  404. }
  405. if (<PropertyNewsEntity>[] is M) {
  406. return data.map<PropertyNewsEntity>((Map<String, dynamic> e) =>
  407. PropertyNewsEntity.fromJson(e)).toList() as M;
  408. }
  409. if (<PropertyNewsList>[] is M) {
  410. return data.map<PropertyNewsList>((Map<String, dynamic> e) =>
  411. PropertyNewsList.fromJson(e)).toList() as M;
  412. }
  413. if (<PropertySaleRentEntity>[] is M) {
  414. return data.map<PropertySaleRentEntity>((Map<String, dynamic> e) =>
  415. PropertySaleRentEntity.fromJson(e)).toList() as M;
  416. }
  417. if (<PropertySaleRentList>[] is M) {
  418. return data.map<PropertySaleRentList>((Map<String, dynamic> e) =>
  419. PropertySaleRentList.fromJson(e)).toList() as M;
  420. }
  421. if (<RewardsCategoryEntity>[] is M) {
  422. return data.map<RewardsCategoryEntity>((Map<String, dynamic> e) =>
  423. RewardsCategoryEntity.fromJson(e)).toList() as M;
  424. }
  425. if (<RewardsHistoryEarnedEntity>[] is M) {
  426. return data.map<RewardsHistoryEarnedEntity>((Map<String, dynamic> e) =>
  427. RewardsHistoryEarnedEntity.fromJson(e)).toList() as M;
  428. }
  429. if (<RewardsHomeEntity>[] is M) {
  430. return data.map<RewardsHomeEntity>((Map<String, dynamic> e) =>
  431. RewardsHomeEntity.fromJson(e)).toList() as M;
  432. }
  433. if (<RewardsHomeData>[] is M) {
  434. return data.map<RewardsHomeData>((Map<String, dynamic> e) =>
  435. RewardsHomeData.fromJson(e)).toList() as M;
  436. }
  437. if (<RewardsHomeDataRewards>[] is M) {
  438. return data.map<RewardsHomeDataRewards>((Map<String, dynamic> e) =>
  439. RewardsHomeDataRewards.fromJson(e)).toList() as M;
  440. }
  441. if (<RewardsHomeTesEntity>[] is M) {
  442. return data.map<RewardsHomeTesEntity>((Map<String, dynamic> e) =>
  443. RewardsHomeTesEntity.fromJson(e)).toList() as M;
  444. }
  445. if (<RewardsHomeTesRewards>[] is M) {
  446. return data.map<RewardsHomeTesRewards>((Map<String, dynamic> e) =>
  447. RewardsHomeTesRewards.fromJson(e)).toList() as M;
  448. }
  449. if (<RewardsHomeTestEntity>[] is M) {
  450. return data.map<RewardsHomeTestEntity>((Map<String, dynamic> e) =>
  451. RewardsHomeTestEntity.fromJson(e)).toList() as M;
  452. }
  453. if (<RewardsHomeTxEntity>[] is M) {
  454. return data.map<RewardsHomeTxEntity>((Map<String, dynamic> e) =>
  455. RewardsHomeTxEntity.fromJson(e)).toList() as M;
  456. }
  457. if (<RewardsIndexEntity>[] is M) {
  458. return data.map<RewardsIndexEntity>((Map<String, dynamic> e) =>
  459. RewardsIndexEntity.fromJson(e)).toList() as M;
  460. }
  461. if (<RewardsIndexContinuous>[] is M) {
  462. return data.map<RewardsIndexContinuous>((Map<String, dynamic> e) =>
  463. RewardsIndexContinuous.fromJson(e)).toList() as M;
  464. }
  465. if (<RewardsIndexTasks>[] is M) {
  466. return data.map<RewardsIndexTasks>((Map<String, dynamic> e) =>
  467. RewardsIndexTasks.fromJson(e)).toList() as M;
  468. }
  469. if (<RewardsListEntity>[] is M) {
  470. return data.map<RewardsListEntity>((Map<String, dynamic> e) =>
  471. RewardsListEntity.fromJson(e)).toList() as M;
  472. }
  473. if (<RewardsListList>[] is M) {
  474. return data.map<RewardsListList>((Map<String, dynamic> e) =>
  475. RewardsListList.fromJson(e)).toList() as M;
  476. }
  477. if (<ServerTime>[] is M) {
  478. return data.map<ServerTime>((Map<String, dynamic> e) =>
  479. ServerTime.fromJson(e)).toList() as M;
  480. }
  481. if (<TextKonEntity>[] is M) {
  482. return data.map<TextKonEntity>((Map<String, dynamic> e) =>
  483. TextKonEntity.fromJson(e)).toList() as M;
  484. }
  485. if (<UserMeEntity>[] is M) {
  486. return data.map<UserMeEntity>((Map<String, dynamic> e) =>
  487. UserMeEntity.fromJson(e)).toList() as M;
  488. }
  489. if (<UserMeHouseholds>[] is M) {
  490. return data.map<UserMeHouseholds>((Map<String, dynamic> e) =>
  491. UserMeHouseholds.fromJson(e)).toList() as M;
  492. }
  493. if (<UserMeEstates>[] is M) {
  494. return data.map<UserMeEstates>((Map<String, dynamic> e) =>
  495. UserMeEstates.fromJson(e)).toList() as M;
  496. }
  497. if (<UserMeEstatesAccounts>[] is M) {
  498. return data.map<UserMeEstatesAccounts>((Map<String, dynamic> e) =>
  499. UserMeEstatesAccounts.fromJson(e)).toList() as M;
  500. }
  501. if (<UserMeEstatesAccountsUnit>[] is M) {
  502. return data.map<UserMeEstatesAccountsUnit>((Map<String, dynamic> e) =>
  503. UserMeEstatesAccountsUnit.fromJson(e)).toList() as M;
  504. }
  505. if (<UserMeDefaultUnit>[] is M) {
  506. return data.map<UserMeDefaultUnit>((Map<String, dynamic> e) =>
  507. UserMeDefaultUnit.fromJson(e)).toList() as M;
  508. }
  509. if (<UserMeInformation>[] is M) {
  510. return data.map<UserMeInformation>((Map<String, dynamic> e) =>
  511. UserMeInformation.fromJson(e)).toList() as M;
  512. }
  513. if (<VisitorPageEntity>[] is M) {
  514. return data.map<VisitorPageEntity>((Map<String, dynamic> e) =>
  515. VisitorPageEntity.fromJson(e)).toList() as M;
  516. }
  517. if (<VisitorPageList>[] is M) {
  518. return data.map<VisitorPageList>((Map<String, dynamic> e) =>
  519. VisitorPageList.fromJson(e)).toList() as M;
  520. }
  521. debugPrint("$M not found");
  522. return null;
  523. }
  524. static M? fromJsonAsT<M>(dynamic json) {
  525. if (json is M) {
  526. return json;
  527. }
  528. if (json is List) {
  529. return _getListChildType<M>(
  530. json.map((dynamic e) => e as Map<String, dynamic>).toList());
  531. } else {
  532. return jsonConvert.convert<M>(json);
  533. }
  534. }
  535. }
  536. class JsonConvertClassCollection {
  537. Map<String, JsonConvertFunction> convertFuncMap = {
  538. (AuthLoginEntity).toString(): AuthLoginEntity.fromJson,
  539. (CaptchaImgEntity).toString(): CaptchaImgEntity.fromJson,
  540. (FacilityBookEntity).toString(): FacilityBookEntity.fromJson,
  541. (FacilityBookFacilityType).toString(): FacilityBookFacilityType.fromJson,
  542. (FacilityBookFacilities).toString(): FacilityBookFacilities.fromJson,
  543. (FacilityBookFacilitiesPeriods).toString(): FacilityBookFacilitiesPeriods
  544. .fromJson,
  545. (FacilityIndexEntity).toString(): FacilityIndexEntity.fromJson,
  546. (FacilityPageEntity).toString(): FacilityPageEntity.fromJson,
  547. (FacilityDetail).toString(): FacilityDetail.fromJson,
  548. (FacilityPageListBooking).toString(): FacilityPageListBooking.fromJson,
  549. (FacilityPageListFacility).toString(): FacilityPageListFacility.fromJson,
  550. (FacilityPageListFacilityType).toString(): FacilityPageListFacilityType
  551. .fromJson,
  552. (FacilityPageListTimePeriod).toString(): FacilityPageListTimePeriod
  553. .fromJson,
  554. (FacilityPageListAccount).toString(): FacilityPageListAccount.fromJson,
  555. (FeedbackDetailEntity).toString(): FeedbackDetailEntity.fromJson,
  556. (FeedbackDetailReplies).toString(): FeedbackDetailReplies.fromJson,
  557. (FeedbackListEntity).toString(): FeedbackListEntity.fromJson,
  558. (FeedbackItemEntity).toString(): FeedbackItemEntity.fromJson,
  559. (FormContentEntity).toString(): FormContentEntity.fromJson,
  560. (FormDetailEntity).toString(): FormDetailEntity.fromJson,
  561. (FormListEntity).toString(): FormListEntity.fromJson,
  562. (FormOptionEntity).toString(): FormOptionEntity.fromJson,
  563. (FormSubmittedEntity).toString(): FormSubmittedEntity.fromJson,
  564. (FormSubmittedEstateOnlineForm).toString(): FormSubmittedEstateOnlineForm
  565. .fromJson,
  566. (FormSubmittedPageEntity).toString(): FormSubmittedPageEntity.fromJson,
  567. (GarageSaleRentDetailEntity).toString(): GarageSaleRentDetailEntity
  568. .fromJson,
  569. (GarageSaleRentDetailAccount).toString(): GarageSaleRentDetailAccount
  570. .fromJson,
  571. (GarageSaleRentEntity).toString(): GarageSaleRentEntity.fromJson,
  572. (GarageSaleRentList).toString(): GarageSaleRentList.fromJson,
  573. (GarageSaleRentListAccount).toString(): GarageSaleRentListAccount.fromJson,
  574. (IdNameEntity).toString(): IdNameEntity.fromJson,
  575. (MyfollowingListEntity).toString(): MyfollowingListEntity.fromJson,
  576. (MypostsNewsfeedEntity).toString(): MypostsNewsfeedEntity.fromJson,
  577. (MypostsNewsfeedList).toString(): MypostsNewsfeedList.fromJson,
  578. (MypostsNewsfeedListAccount).toString(): MypostsNewsfeedListAccount
  579. .fromJson,
  580. (MypostsSaleRentEntity).toString(): MypostsSaleRentEntity.fromJson,
  581. (MypostsSaleRentList).toString(): MypostsSaleRentList.fromJson,
  582. (NewsfeedCommentPublishEntity).toString(): NewsfeedCommentPublishEntity
  583. .fromJson,
  584. (NewsfeedDetailEntity).toString(): NewsfeedDetailEntity.fromJson,
  585. (NewsfeedDetailAccount).toString(): NewsfeedDetailAccount.fromJson,
  586. (NewsfeedDetailComments).toString(): NewsfeedDetailComments.fromJson,
  587. (NewsfeedDetailCommentsAccount).toString(): NewsfeedDetailCommentsAccount
  588. .fromJson,
  589. (NewsfeedDetailCommentsToAccount)
  590. .toString(): NewsfeedDetailCommentsToAccount.fromJson,
  591. (NewsfeedFollowingEntity).toString(): NewsfeedFollowingEntity.fromJson,
  592. (NewsfeedFollowingList).toString(): NewsfeedFollowingList.fromJson,
  593. (NewsfeedFollowingListAccount).toString(): NewsfeedFollowingListAccount
  594. .fromJson,
  595. (NewsfeedForyouEntity).toString(): NewsfeedForyouEntity.fromJson,
  596. (NewsfeedForyouList).toString(): NewsfeedForyouList.fromJson,
  597. (NewsfeedForyouListAccount).toString(): NewsfeedForyouListAccount.fromJson,
  598. (NewsfeedNewsEntity).toString(): NewsfeedNewsEntity.fromJson,
  599. (NewsfeedNewsList).toString(): NewsfeedNewsList.fromJson,
  600. (NewsfeedNewsListAccount).toString(): NewsfeedNewsListAccount.fromJson,
  601. (NoticeBoardAnnounEntity).toString(): NoticeBoardAnnounEntity.fromJson,
  602. (NoticeBoardDocumentsEntity).toString(): NoticeBoardDocumentsEntity
  603. .fromJson,
  604. (NoticeBoardEventEntity).toString(): NoticeBoardEventEntity.fromJson,
  605. (PaymentPageEntity).toString(): PaymentPageEntity.fromJson,
  606. (PaymentPageList).toString(): PaymentPageList.fromJson,
  607. (PropertyNewsEntity).toString(): PropertyNewsEntity.fromJson,
  608. (PropertyNewsList).toString(): PropertyNewsList.fromJson,
  609. (PropertySaleRentEntity).toString(): PropertySaleRentEntity.fromJson,
  610. (PropertySaleRentList).toString(): PropertySaleRentList.fromJson,
  611. (RewardsCategoryEntity).toString(): RewardsCategoryEntity.fromJson,
  612. (RewardsHistoryEarnedEntity).toString(): RewardsHistoryEarnedEntity
  613. .fromJson,
  614. (RewardsHomeEntity).toString(): RewardsHomeEntity.fromJson,
  615. (RewardsHomeData).toString(): RewardsHomeData.fromJson,
  616. (RewardsHomeDataRewards).toString(): RewardsHomeDataRewards.fromJson,
  617. (RewardsHomeTesEntity).toString(): RewardsHomeTesEntity.fromJson,
  618. (RewardsHomeTesRewards).toString(): RewardsHomeTesRewards.fromJson,
  619. (RewardsHomeTestEntity).toString(): RewardsHomeTestEntity.fromJson,
  620. (RewardsHomeTxEntity).toString(): RewardsHomeTxEntity.fromJson,
  621. (RewardsIndexEntity).toString(): RewardsIndexEntity.fromJson,
  622. (RewardsIndexContinuous).toString(): RewardsIndexContinuous.fromJson,
  623. (RewardsIndexTasks).toString(): RewardsIndexTasks.fromJson,
  624. (RewardsListEntity).toString(): RewardsListEntity.fromJson,
  625. (RewardsListList).toString(): RewardsListList.fromJson,
  626. (ServerTime).toString(): ServerTime.fromJson,
  627. (TextKonEntity).toString(): TextKonEntity.fromJson,
  628. (UserMeEntity).toString(): UserMeEntity.fromJson,
  629. (UserMeHouseholds).toString(): UserMeHouseholds.fromJson,
  630. (UserMeEstates).toString(): UserMeEstates.fromJson,
  631. (UserMeEstatesAccounts).toString(): UserMeEstatesAccounts.fromJson,
  632. (UserMeEstatesAccountsUnit).toString(): UserMeEstatesAccountsUnit.fromJson,
  633. (UserMeDefaultUnit).toString(): UserMeDefaultUnit.fromJson,
  634. (UserMeInformation).toString(): UserMeInformation.fromJson,
  635. (VisitorPageEntity).toString(): VisitorPageEntity.fromJson,
  636. (VisitorPageList).toString(): VisitorPageList.fromJson,
  637. };
  638. bool containsKey(String type) {
  639. return convertFuncMap.containsKey(type);
  640. }
  641. JsonConvertFunction? operator [](String key) {
  642. return convertFuncMap[key];
  643. }
  644. }