json_convert_content.dart 26 KB

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