json_convert_content.dart 29 KB

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