json_convert_content.dart 29 KB

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