json_convert_content.dart 24 KB

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