json_convert_content.dart 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563
  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/response/attendance_entity.dart';
  7. import 'package:domain/entity/response/check_success_entity.dart';
  8. import 'package:domain/entity/response/device_list_entity.dart';
  9. import 'package:domain/entity/response/hotel_info_entity.dart';
  10. import 'package:domain/entity/response/id_name_entity.dart';
  11. import 'package:domain/entity/response/job_applied_edit_index_s_g_entity.dart';
  12. import 'package:domain/entity/response/job_applied_index_s_g_entity.dart';
  13. import 'package:domain/entity/response/job_applied_list_s_g_entity.dart';
  14. import 'package:domain/entity/response/job_applied_remark_view_s_g_entity.dart';
  15. import 'package:domain/entity/response/job_applied_staff_s_g_entity.dart';
  16. import 'package:domain/entity/response/job_list_add_staff_entity.dart';
  17. import 'package:domain/entity/response/job_list_applied_edit_entity.dart';
  18. import 'package:domain/entity/response/job_list_applied_info_entity.dart';
  19. import 'package:domain/entity/response/job_list_applied_staff_list_entity.dart';
  20. import 'package:domain/entity/response/job_list_applied_staff_search_entity.dart';
  21. import 'package:domain/entity/response/job_list_applied_work_flow_entity.dart';
  22. import 'package:domain/entity/response/job_list_detail_entity.dart';
  23. import 'package:domain/entity/response/job_list_edit_index_s_g_entity.dart';
  24. import 'package:domain/entity/response/job_list_entity.dart';
  25. import 'package:domain/entity/response/job_list_index_entity.dart';
  26. import 'package:domain/entity/response/job_list_index_s_g_entity.dart';
  27. import 'package:domain/entity/response/job_list_remark_view_entity.dart';
  28. import 'package:domain/entity/response/job_list_s_g_entity.dart';
  29. import 'package:domain/entity/response/job_template_edit_index_entity.dart';
  30. import 'package:domain/entity/response/job_template_s_g_entity.dart';
  31. import 'package:domain/entity/response/job_title_edit_index_entity.dart';
  32. import 'package:domain/entity/response/job_title_s_g_entity.dart';
  33. import 'package:domain/entity/response/labour_request_edit_index_entity.dart';
  34. import 'package:domain/entity/response/labour_request_index_entity.dart';
  35. import 'package:domain/entity/response/labour_request_list_entity.dart';
  36. import 'package:domain/entity/response/labour_request_s_g_add_index_entity.dart';
  37. import 'package:domain/entity/response/labour_request_s_g_entity.dart';
  38. import 'package:domain/entity/response/labour_request_work_flow_entity.dart';
  39. import 'package:domain/entity/response/staff_detail_entity.dart';
  40. import 'package:domain/entity/response/staff_detail_s_g_entity.dart';
  41. import 'package:domain/entity/response/staff_job_history_s_g_entity.dart';
  42. import 'package:domain/entity/response/staff_labour_history_entity.dart';
  43. import 'package:domain/entity/response/staff_remark_history_entity.dart';
  44. import 'package:domain/entity/response/staff_review_history_s_g_entity.dart';
  45. import 'package:domain/entity/server_time.dart';
  46. JsonConvert jsonConvert = JsonConvert();
  47. typedef JsonConvertFunction<T> = T Function(Map<String, dynamic> json);
  48. typedef EnumConvertFunction<T> = T Function(String value);
  49. typedef ConvertExceptionHandler = void Function(Object error, StackTrace stackTrace);
  50. extension MapSafeExt<K, V> on Map<K, V> {
  51. T? getOrNull<T>(K? key) {
  52. if (!containsKey(key) || key == null) {
  53. return null;
  54. } else {
  55. return this[key] as T?;
  56. }
  57. }
  58. }
  59. class JsonConvert {
  60. static ConvertExceptionHandler? onError;
  61. JsonConvertClassCollection convertFuncMap = JsonConvertClassCollection();
  62. /// 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
  63. /// https://flutter.cn/docs/development/tools/hot-reload
  64. /// class MyApp extends StatelessWidget {
  65. /// const MyApp({Key? key})
  66. /// : super(key: key);
  67. ///
  68. /// @override
  69. /// Widget build(BuildContext context) {
  70. /// jsonConvert.reassembleConvertFuncMap();
  71. /// return MaterialApp();
  72. /// }
  73. /// }
  74. void reassembleConvertFuncMap() {
  75. bool isReleaseMode = const bool.fromEnvironment('dart.vm.product');
  76. if (!isReleaseMode) {
  77. convertFuncMap = JsonConvertClassCollection();
  78. }
  79. }
  80. T? convert<T>(dynamic value, {EnumConvertFunction? enumConvert}) {
  81. if (value == null) {
  82. return null;
  83. }
  84. if (value is T) {
  85. return value;
  86. }
  87. try {
  88. return _asT<T>(value, enumConvert: enumConvert);
  89. } catch (e, stackTrace) {
  90. debugPrint('asT<$T> $e $stackTrace');
  91. if (onError != null) {
  92. onError!(e, stackTrace);
  93. }
  94. return null;
  95. }
  96. }
  97. List<T?>? convertList<T>(List<dynamic>? value, {EnumConvertFunction? enumConvert}) {
  98. if (value == null) {
  99. return null;
  100. }
  101. try {
  102. return value.map((dynamic e) => _asT<T>(e, enumConvert: enumConvert)).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, {EnumConvertFunction? enumConvert}) {
  112. if (value == null) {
  113. return null;
  114. }
  115. try {
  116. return (value as List<dynamic>).map((dynamic e) => _asT<T>(e, enumConvert: enumConvert)!).toList();
  117. } catch (e, stackTrace) {
  118. debugPrint('asT<$T> $e $stackTrace');
  119. if (onError != null) {
  120. onError!(e, stackTrace);
  121. }
  122. return <T>[];
  123. }
  124. }
  125. T? _asT<T extends Object?>(dynamic value,
  126. {EnumConvertFunction? enumConvert}) {
  127. final String type = T.toString();
  128. final String valueS = value.toString();
  129. if (enumConvert != null) {
  130. return enumConvert(valueS) as T;
  131. } else if (type == "String") {
  132. return valueS as T;
  133. } else if (type == "int") {
  134. final int? intValue = int.tryParse(valueS);
  135. if (intValue == null) {
  136. return double.tryParse(valueS)?.toInt() as T?;
  137. } else {
  138. return intValue as T;
  139. }
  140. } else if (type == "double") {
  141. return double.parse(valueS) as T;
  142. } else if (type == "DateTime") {
  143. return DateTime.parse(valueS) as T;
  144. } else if (type == "bool") {
  145. if (valueS == '0' || valueS == '1') {
  146. return (valueS == '1') as T;
  147. }
  148. return (valueS == 'true') as T;
  149. } else if (type == "Map" || type.startsWith("Map<")) {
  150. return value as T;
  151. } else {
  152. if (convertFuncMap.containsKey(type)) {
  153. if (value == null) {
  154. return null;
  155. }
  156. return convertFuncMap[type]!(value as Map<String, dynamic>) as T;
  157. } else {
  158. throw UnimplementedError('$type unimplemented,you can try running the app again');
  159. }
  160. }
  161. }
  162. //list is returned by type
  163. static M? _getListChildType<M>(List<Map<String, dynamic>> data) {
  164. if (<AttendanceEntity>[] is M) {
  165. return data.map<AttendanceEntity>((Map<String, dynamic> e) => AttendanceEntity.fromJson(e)).toList() as M;
  166. }
  167. if (<AttendanceList>[] is M) {
  168. return data.map<AttendanceList>((Map<String, dynamic> e) => AttendanceList.fromJson(e)).toList() as M;
  169. }
  170. if (<CheckSuccessEntity>[] is M) {
  171. return data.map<CheckSuccessEntity>((Map<String, dynamic> e) => CheckSuccessEntity.fromJson(e)).toList() as M;
  172. }
  173. if (<DeviceListEntity>[] is M) {
  174. return data.map<DeviceListEntity>((Map<String, dynamic> e) => DeviceListEntity.fromJson(e)).toList() as M;
  175. }
  176. if (<DeviceListRows>[] is M) {
  177. return data.map<DeviceListRows>((Map<String, dynamic> e) => DeviceListRows.fromJson(e)).toList() as M;
  178. }
  179. if (<HotelInfoEntity>[] is M) {
  180. return data.map<HotelInfoEntity>((Map<String, dynamic> e) => HotelInfoEntity.fromJson(e)).toList() as M;
  181. }
  182. if (<HotelInfoMenus>[] is M) {
  183. return data.map<HotelInfoMenus>((Map<String, dynamic> e) => HotelInfoMenus.fromJson(e)).toList() as M;
  184. }
  185. if (<HotelInfoMenusChildren>[] is M) {
  186. return data.map<HotelInfoMenusChildren>((Map<String, dynamic> e) => HotelInfoMenusChildren.fromJson(e)).toList() as M;
  187. }
  188. if (<IdNameEntity>[] is M) {
  189. return data.map<IdNameEntity>((Map<String, dynamic> e) => IdNameEntity.fromJson(e)).toList() as M;
  190. }
  191. if (<JobAppliedEditIndexSGEntity>[] is M) {
  192. return data.map<JobAppliedEditIndexSGEntity>((Map<String, dynamic> e) => JobAppliedEditIndexSGEntity.fromJson(e)).toList() as M;
  193. }
  194. if (<JobAppliedEditIndexSGStatusList>[] is M) {
  195. return data.map<JobAppliedEditIndexSGStatusList>((Map<String, dynamic> e) => JobAppliedEditIndexSGStatusList.fromJson(e)).toList() as M;
  196. }
  197. if (<JobAppliedIndexSGEntity>[] is M) {
  198. return data.map<JobAppliedIndexSGEntity>((Map<String, dynamic> e) => JobAppliedIndexSGEntity.fromJson(e)).toList() as M;
  199. }
  200. if (<JobAppliedIndexSGStatusList>[] is M) {
  201. return data.map<JobAppliedIndexSGStatusList>((Map<String, dynamic> e) => JobAppliedIndexSGStatusList.fromJson(e)).toList() as M;
  202. }
  203. if (<JobAppliedListSGEntity>[] is M) {
  204. return data.map<JobAppliedListSGEntity>((Map<String, dynamic> e) => JobAppliedListSGEntity.fromJson(e)).toList() as M;
  205. }
  206. if (<JobAppliedListSGRows>[] is M) {
  207. return data.map<JobAppliedListSGRows>((Map<String, dynamic> e) => JobAppliedListSGRows.fromJson(e)).toList() as M;
  208. }
  209. if (<JobAppliedListSGRowsCheck>[] is M) {
  210. return data.map<JobAppliedListSGRowsCheck>((Map<String, dynamic> e) => JobAppliedListSGRowsCheck.fromJson(e)).toList() as M;
  211. }
  212. if (<JobAppliedListSGRowsStatusList>[] is M) {
  213. return data.map<JobAppliedListSGRowsStatusList>((Map<String, dynamic> e) => JobAppliedListSGRowsStatusList.fromJson(e)).toList() as M;
  214. }
  215. if (<JobAppliedRemarkViewSGEntity>[] is M) {
  216. return data.map<JobAppliedRemarkViewSGEntity>((Map<String, dynamic> e) => JobAppliedRemarkViewSGEntity.fromJson(e)).toList() as M;
  217. }
  218. if (<JobAppliedStaffSGEntity>[] is M) {
  219. return data.map<JobAppliedStaffSGEntity>((Map<String, dynamic> e) => JobAppliedStaffSGEntity.fromJson(e)).toList() as M;
  220. }
  221. if (<JobAppliedStaffSGRows>[] is M) {
  222. return data.map<JobAppliedStaffSGRows>((Map<String, dynamic> e) => JobAppliedStaffSGRows.fromJson(e)).toList() as M;
  223. }
  224. if (<JobListAddStaffEntity>[] is M) {
  225. return data.map<JobListAddStaffEntity>((Map<String, dynamic> e) => JobListAddStaffEntity.fromJson(e)).toList() as M;
  226. }
  227. if (<JobListAddStaffResultList>[] is M) {
  228. return data.map<JobListAddStaffResultList>((Map<String, dynamic> e) => JobListAddStaffResultList.fromJson(e)).toList() as M;
  229. }
  230. if (<JobListAppliedEditEntity>[] is M) {
  231. return data.map<JobListAppliedEditEntity>((Map<String, dynamic> e) => JobListAppliedEditEntity.fromJson(e)).toList() as M;
  232. }
  233. if (<JobListAppliedEditReasonList>[] is M) {
  234. return data.map<JobListAppliedEditReasonList>((Map<String, dynamic> e) => JobListAppliedEditReasonList.fromJson(e)).toList() as M;
  235. }
  236. if (<JobListAppliedInfoEntity>[] is M) {
  237. return data.map<JobListAppliedInfoEntity>((Map<String, dynamic> e) => JobListAppliedInfoEntity.fromJson(e)).toList() as M;
  238. }
  239. if (<JobListAppliedStaffListEntity>[] is M) {
  240. return data.map<JobListAppliedStaffListEntity>((Map<String, dynamic> e) => JobListAppliedStaffListEntity.fromJson(e)).toList() as M;
  241. }
  242. if (<JobListAppliedStaffListRows>[] is M) {
  243. return data.map<JobListAppliedStaffListRows>((Map<String, dynamic> e) => JobListAppliedStaffListRows.fromJson(e)).toList() as M;
  244. }
  245. if (<JobListAppliedStaffListRowsSecurityIn>[] is M) {
  246. return data.map<JobListAppliedStaffListRowsSecurityIn>((Map<String, dynamic> e) => JobListAppliedStaffListRowsSecurityIn.fromJson(e)).toList() as M;
  247. }
  248. if (<JobListAppliedStaffListRowsSecurityOut>[] is M) {
  249. return data.map<JobListAppliedStaffListRowsSecurityOut>((Map<String, dynamic> e) => JobListAppliedStaffListRowsSecurityOut.fromJson(e)).toList() as M;
  250. }
  251. if (<JobListAppliedStaffListRowsWorkIn>[] is M) {
  252. return data.map<JobListAppliedStaffListRowsWorkIn>((Map<String, dynamic> e) => JobListAppliedStaffListRowsWorkIn.fromJson(e)).toList() as M;
  253. }
  254. if (<JobListAppliedStaffListRowsWorkOut>[] is M) {
  255. return data.map<JobListAppliedStaffListRowsWorkOut>((Map<String, dynamic> e) => JobListAppliedStaffListRowsWorkOut.fromJson(e)).toList() as M;
  256. }
  257. if (<JobListAppliedStaffSearchEntity>[] is M) {
  258. return data.map<JobListAppliedStaffSearchEntity>((Map<String, dynamic> e) => JobListAppliedStaffSearchEntity.fromJson(e)).toList() as M;
  259. }
  260. if (<JobListAppliedStaffSearchRows>[] is M) {
  261. return data.map<JobListAppliedStaffSearchRows>((Map<String, dynamic> e) => JobListAppliedStaffSearchRows.fromJson(e)).toList() as M;
  262. }
  263. if (<JobListAppliedWorkFlowEntity>[] is M) {
  264. return data.map<JobListAppliedWorkFlowEntity>((Map<String, dynamic> e) => JobListAppliedWorkFlowEntity.fromJson(e)).toList() as M;
  265. }
  266. if (<JobListAppliedWorkFlowRecords>[] is M) {
  267. return data.map<JobListAppliedWorkFlowRecords>((Map<String, dynamic> e) => JobListAppliedWorkFlowRecords.fromJson(e)).toList() as M;
  268. }
  269. if (<JobListDetailEntity>[] is M) {
  270. return data.map<JobListDetailEntity>((Map<String, dynamic> e) => JobListDetailEntity.fromJson(e)).toList() as M;
  271. }
  272. if (<JobListDetailDepartmentList>[] is M) {
  273. return data.map<JobListDetailDepartmentList>((Map<String, dynamic> e) => JobListDetailDepartmentList.fromJson(e)).toList() as M;
  274. }
  275. if (<JobListEditIndexSGEntity>[] is M) {
  276. return data.map<JobListEditIndexSGEntity>((Map<String, dynamic> e) => JobListEditIndexSGEntity.fromJson(e)).toList() as M;
  277. }
  278. if (<JobListEditIndexOption>[] is M) {
  279. return data.map<JobListEditIndexOption>((Map<String, dynamic> e) => JobListEditIndexOption.fromJson(e)).toList() as M;
  280. }
  281. if (<JobListEntity>[] is M) {
  282. return data.map<JobListEntity>((Map<String, dynamic> e) => JobListEntity.fromJson(e)).toList() as M;
  283. }
  284. if (<JobListRows>[] is M) {
  285. return data.map<JobListRows>((Map<String, dynamic> e) => JobListRows.fromJson(e)).toList() as M;
  286. }
  287. if (<JobListIndexEntity>[] is M) {
  288. return data.map<JobListIndexEntity>((Map<String, dynamic> e) => JobListIndexEntity.fromJson(e)).toList() as M;
  289. }
  290. if (<JobListIndexDepartmentList>[] is M) {
  291. return data.map<JobListIndexDepartmentList>((Map<String, dynamic> e) => JobListIndexDepartmentList.fromJson(e)).toList() as M;
  292. }
  293. if (<JobListIndexStatusList>[] is M) {
  294. return data.map<JobListIndexStatusList>((Map<String, dynamic> e) => JobListIndexStatusList.fromJson(e)).toList() as M;
  295. }
  296. if (<JobListIndexSGEntity>[] is M) {
  297. return data.map<JobListIndexSGEntity>((Map<String, dynamic> e) => JobListIndexSGEntity.fromJson(e)).toList() as M;
  298. }
  299. if (<JobListIndexSGOption>[] is M) {
  300. return data.map<JobListIndexSGOption>((Map<String, dynamic> e) => JobListIndexSGOption.fromJson(e)).toList() as M;
  301. }
  302. if (<JobListRemarkViewEntity>[] is M) {
  303. return data.map<JobListRemarkViewEntity>((Map<String, dynamic> e) => JobListRemarkViewEntity.fromJson(e)).toList() as M;
  304. }
  305. if (<JobListSGEntity>[] is M) {
  306. return data.map<JobListSGEntity>((Map<String, dynamic> e) => JobListSGEntity.fromJson(e)).toList() as M;
  307. }
  308. if (<JobListSGRows>[] is M) {
  309. return data.map<JobListSGRows>((Map<String, dynamic> e) => JobListSGRows.fromJson(e)).toList() as M;
  310. }
  311. if (<JobTemplateEditIndexEntity>[] is M) {
  312. return data.map<JobTemplateEditIndexEntity>((Map<String, dynamic> e) => JobTemplateEditIndexEntity.fromJson(e)).toList() as M;
  313. }
  314. if (<JobTemplateEditIndexAgeList>[] is M) {
  315. return data.map<JobTemplateEditIndexAgeList>((Map<String, dynamic> e) => JobTemplateEditIndexAgeList.fromJson(e)).toList() as M;
  316. }
  317. if (<JobTemplateEditIndexSexList>[] is M) {
  318. return data.map<JobTemplateEditIndexSexList>((Map<String, dynamic> e) => JobTemplateEditIndexSexList.fromJson(e)).toList() as M;
  319. }
  320. if (<JobTemplateEditIndexLanguageList>[] is M) {
  321. return data.map<JobTemplateEditIndexLanguageList>((Map<String, dynamic> e) => JobTemplateEditIndexLanguageList.fromJson(e)).toList() as M;
  322. }
  323. if (<JobTemplateSGEntity>[] is M) {
  324. return data.map<JobTemplateSGEntity>((Map<String, dynamic> e) => JobTemplateSGEntity.fromJson(e)).toList() as M;
  325. }
  326. if (<JobTemplateSGRows>[] is M) {
  327. return data.map<JobTemplateSGRows>((Map<String, dynamic> e) => JobTemplateSGRows.fromJson(e)).toList() as M;
  328. }
  329. if (<JobTitleEditIndexEntity>[] is M) {
  330. return data.map<JobTitleEditIndexEntity>((Map<String, dynamic> e) => JobTitleEditIndexEntity.fromJson(e)).toList() as M;
  331. }
  332. if (<JobTitleEditIndexTemplate>[] is M) {
  333. return data.map<JobTitleEditIndexTemplate>((Map<String, dynamic> e) => JobTitleEditIndexTemplate.fromJson(e)).toList() as M;
  334. }
  335. if (<JobTitleSGEntity>[] is M) {
  336. return data.map<JobTitleSGEntity>((Map<String, dynamic> e) => JobTitleSGEntity.fromJson(e)).toList() as M;
  337. }
  338. if (<JobTitleSGRows>[] is M) {
  339. return data.map<JobTitleSGRows>((Map<String, dynamic> e) => JobTitleSGRows.fromJson(e)).toList() as M;
  340. }
  341. if (<LabourRequestEditIndexEntity>[] is M) {
  342. return data.map<LabourRequestEditIndexEntity>((Map<String, dynamic> e) => LabourRequestEditIndexEntity.fromJson(e)).toList() as M;
  343. }
  344. if (<LabourRequestEditIndexTemplateList>[] is M) {
  345. return data.map<LabourRequestEditIndexTemplateList>((Map<String, dynamic> e) => LabourRequestEditIndexTemplateList.fromJson(e)).toList() as M;
  346. }
  347. if (<LabourRequestEditIndexDepartmentList>[] is M) {
  348. return data.map<LabourRequestEditIndexDepartmentList>((Map<String, dynamic> e) => LabourRequestEditIndexDepartmentList.fromJson(e)).toList() as M;
  349. }
  350. if (<LabourRequestIndexEntity>[] is M) {
  351. return data.map<LabourRequestIndexEntity>((Map<String, dynamic> e) => LabourRequestIndexEntity.fromJson(e)).toList() as M;
  352. }
  353. if (<LabourRequestIndexDepartmentList>[] is M) {
  354. return data.map<LabourRequestIndexDepartmentList>((Map<String, dynamic> e) => LabourRequestIndexDepartmentList.fromJson(e)).toList() as M;
  355. }
  356. if (<LabourRequestIndexStatusList>[] is M) {
  357. return data.map<LabourRequestIndexStatusList>((Map<String, dynamic> e) => LabourRequestIndexStatusList.fromJson(e)).toList() as M;
  358. }
  359. if (<LabourRequestListEntity>[] is M) {
  360. return data.map<LabourRequestListEntity>((Map<String, dynamic> e) => LabourRequestListEntity.fromJson(e)).toList() as M;
  361. }
  362. if (<LabourRequestListRows>[] is M) {
  363. return data.map<LabourRequestListRows>((Map<String, dynamic> e) => LabourRequestListRows.fromJson(e)).toList() as M;
  364. }
  365. if (<LabourRequestSGAddIndexEntity>[] is M) {
  366. return data.map<LabourRequestSGAddIndexEntity>((Map<String, dynamic> e) => LabourRequestSGAddIndexEntity.fromJson(e)).toList() as M;
  367. }
  368. if (<LabourRequestSGAddIndexOption>[] is M) {
  369. return data.map<LabourRequestSGAddIndexOption>((Map<String, dynamic> e) => LabourRequestSGAddIndexOption.fromJson(e)).toList() as M;
  370. }
  371. if (<LabourRequestSGEntity>[] is M) {
  372. return data.map<LabourRequestSGEntity>((Map<String, dynamic> e) => LabourRequestSGEntity.fromJson(e)).toList() as M;
  373. }
  374. if (<LabourRequestSGCountList>[] is M) {
  375. return data.map<LabourRequestSGCountList>((Map<String, dynamic> e) => LabourRequestSGCountList.fromJson(e)).toList() as M;
  376. }
  377. if (<LabourRequestWorkFlowEntity>[] is M) {
  378. return data.map<LabourRequestWorkFlowEntity>((Map<String, dynamic> e) => LabourRequestWorkFlowEntity.fromJson(e)).toList() as M;
  379. }
  380. if (<LabourRequestWorkFlowRecords>[] is M) {
  381. return data.map<LabourRequestWorkFlowRecords>((Map<String, dynamic> e) => LabourRequestWorkFlowRecords.fromJson(e)).toList() as M;
  382. }
  383. if (<StaffDetailEntity>[] is M) {
  384. return data.map<StaffDetailEntity>((Map<String, dynamic> e) => StaffDetailEntity.fromJson(e)).toList() as M;
  385. }
  386. if (<StaffDetailSGEntity>[] is M) {
  387. return data.map<StaffDetailSGEntity>((Map<String, dynamic> e) => StaffDetailSGEntity.fromJson(e)).toList() as M;
  388. }
  389. if (<StaffDetailSGReviews>[] is M) {
  390. return data.map<StaffDetailSGReviews>((Map<String, dynamic> e) => StaffDetailSGReviews.fromJson(e)).toList() as M;
  391. }
  392. if (<StaffDetailSGReviewsReviews>[] is M) {
  393. return data.map<StaffDetailSGReviewsReviews>((Map<String, dynamic> e) => StaffDetailSGReviewsReviews.fromJson(e)).toList() as M;
  394. }
  395. if (<StaffJobHistorySGEntity>[] is M) {
  396. return data.map<StaffJobHistorySGEntity>((Map<String, dynamic> e) => StaffJobHistorySGEntity.fromJson(e)).toList() as M;
  397. }
  398. if (<StaffJobHistorySGRows>[] is M) {
  399. return data.map<StaffJobHistorySGRows>((Map<String, dynamic> e) => StaffJobHistorySGRows.fromJson(e)).toList() as M;
  400. }
  401. if (<StaffLabourHistoryEntity>[] is M) {
  402. return data.map<StaffLabourHistoryEntity>((Map<String, dynamic> e) => StaffLabourHistoryEntity.fromJson(e)).toList() as M;
  403. }
  404. if (<StaffLabourHistoryRows>[] is M) {
  405. return data.map<StaffLabourHistoryRows>((Map<String, dynamic> e) => StaffLabourHistoryRows.fromJson(e)).toList() as M;
  406. }
  407. if (<StaffLabourHistoryRowsSecurityIn>[] is M) {
  408. return data.map<StaffLabourHistoryRowsSecurityIn>((Map<String, dynamic> e) => StaffLabourHistoryRowsSecurityIn.fromJson(e)).toList() as M;
  409. }
  410. if (<StaffLabourHistoryRowsSecurityOut>[] is M) {
  411. return data.map<StaffLabourHistoryRowsSecurityOut>((Map<String, dynamic> e) => StaffLabourHistoryRowsSecurityOut.fromJson(e)).toList() as M;
  412. }
  413. if (<StaffLabourHistoryRowsWorkIn>[] is M) {
  414. return data.map<StaffLabourHistoryRowsWorkIn>((Map<String, dynamic> e) => StaffLabourHistoryRowsWorkIn.fromJson(e)).toList() as M;
  415. }
  416. if (<StaffLabourHistoryRowsWorkOut>[] is M) {
  417. return data.map<StaffLabourHistoryRowsWorkOut>((Map<String, dynamic> e) => StaffLabourHistoryRowsWorkOut.fromJson(e)).toList() as M;
  418. }
  419. if (<StaffRemarkHistoryEntity>[] is M) {
  420. return data.map<StaffRemarkHistoryEntity>((Map<String, dynamic> e) => StaffRemarkHistoryEntity.fromJson(e)).toList() as M;
  421. }
  422. if (<StaffRemarkHistoryRows>[] is M) {
  423. return data.map<StaffRemarkHistoryRows>((Map<String, dynamic> e) => StaffRemarkHistoryRows.fromJson(e)).toList() as M;
  424. }
  425. if (<StaffReviewHistorySGEntity>[] is M) {
  426. return data.map<StaffReviewHistorySGEntity>((Map<String, dynamic> e) => StaffReviewHistorySGEntity.fromJson(e)).toList() as M;
  427. }
  428. if (<StaffReviewHistorySGReviews>[] is M) {
  429. return data.map<StaffReviewHistorySGReviews>((Map<String, dynamic> e) => StaffReviewHistorySGReviews.fromJson(e)).toList() as M;
  430. }
  431. if (<ServerTime>[] is M) {
  432. return data.map<ServerTime>((Map<String, dynamic> e) => ServerTime.fromJson(e)).toList() as M;
  433. }
  434. debugPrint("$M not found");
  435. return null;
  436. }
  437. static M? fromJsonAsT<M>(dynamic json) {
  438. if (json is M) {
  439. return json;
  440. }
  441. if (json is List) {
  442. return _getListChildType<M>(json.map((dynamic e) => e as Map<String, dynamic>).toList());
  443. } else {
  444. return jsonConvert.convert<M>(json);
  445. }
  446. }
  447. }
  448. class JsonConvertClassCollection {
  449. Map<String, JsonConvertFunction> convertFuncMap = {
  450. (AttendanceEntity).toString(): AttendanceEntity.fromJson,
  451. (AttendanceList).toString(): AttendanceList.fromJson,
  452. (CheckSuccessEntity).toString(): CheckSuccessEntity.fromJson,
  453. (DeviceListEntity).toString(): DeviceListEntity.fromJson,
  454. (DeviceListRows).toString(): DeviceListRows.fromJson,
  455. (HotelInfoEntity).toString(): HotelInfoEntity.fromJson,
  456. (HotelInfoMenus).toString(): HotelInfoMenus.fromJson,
  457. (HotelInfoMenusChildren).toString(): HotelInfoMenusChildren.fromJson,
  458. (IdNameEntity).toString(): IdNameEntity.fromJson,
  459. (JobAppliedEditIndexSGEntity).toString(): JobAppliedEditIndexSGEntity.fromJson,
  460. (JobAppliedEditIndexSGStatusList).toString(): JobAppliedEditIndexSGStatusList.fromJson,
  461. (JobAppliedIndexSGEntity).toString(): JobAppliedIndexSGEntity.fromJson,
  462. (JobAppliedIndexSGStatusList).toString(): JobAppliedIndexSGStatusList.fromJson,
  463. (JobAppliedListSGEntity).toString(): JobAppliedListSGEntity.fromJson,
  464. (JobAppliedListSGRows).toString(): JobAppliedListSGRows.fromJson,
  465. (JobAppliedListSGRowsCheck).toString(): JobAppliedListSGRowsCheck.fromJson,
  466. (JobAppliedListSGRowsStatusList).toString(): JobAppliedListSGRowsStatusList.fromJson,
  467. (JobAppliedRemarkViewSGEntity).toString(): JobAppliedRemarkViewSGEntity.fromJson,
  468. (JobAppliedStaffSGEntity).toString(): JobAppliedStaffSGEntity.fromJson,
  469. (JobAppliedStaffSGRows).toString(): JobAppliedStaffSGRows.fromJson,
  470. (JobListAddStaffEntity).toString(): JobListAddStaffEntity.fromJson,
  471. (JobListAddStaffResultList).toString(): JobListAddStaffResultList.fromJson,
  472. (JobListAppliedEditEntity).toString(): JobListAppliedEditEntity.fromJson,
  473. (JobListAppliedEditReasonList).toString(): JobListAppliedEditReasonList.fromJson,
  474. (JobListAppliedInfoEntity).toString(): JobListAppliedInfoEntity.fromJson,
  475. (JobListAppliedStaffListEntity).toString(): JobListAppliedStaffListEntity.fromJson,
  476. (JobListAppliedStaffListRows).toString(): JobListAppliedStaffListRows.fromJson,
  477. (JobListAppliedStaffListRowsSecurityIn).toString(): JobListAppliedStaffListRowsSecurityIn.fromJson,
  478. (JobListAppliedStaffListRowsSecurityOut).toString(): JobListAppliedStaffListRowsSecurityOut.fromJson,
  479. (JobListAppliedStaffListRowsWorkIn).toString(): JobListAppliedStaffListRowsWorkIn.fromJson,
  480. (JobListAppliedStaffListRowsWorkOut).toString(): JobListAppliedStaffListRowsWorkOut.fromJson,
  481. (JobListAppliedStaffSearchEntity).toString(): JobListAppliedStaffSearchEntity.fromJson,
  482. (JobListAppliedStaffSearchRows).toString(): JobListAppliedStaffSearchRows.fromJson,
  483. (JobListAppliedWorkFlowEntity).toString(): JobListAppliedWorkFlowEntity.fromJson,
  484. (JobListAppliedWorkFlowRecords).toString(): JobListAppliedWorkFlowRecords.fromJson,
  485. (JobListDetailEntity).toString(): JobListDetailEntity.fromJson,
  486. (JobListDetailDepartmentList).toString(): JobListDetailDepartmentList.fromJson,
  487. (JobListEditIndexSGEntity).toString(): JobListEditIndexSGEntity.fromJson,
  488. (JobListEditIndexOption).toString(): JobListEditIndexOption.fromJson,
  489. (JobListEntity).toString(): JobListEntity.fromJson,
  490. (JobListRows).toString(): JobListRows.fromJson,
  491. (JobListIndexEntity).toString(): JobListIndexEntity.fromJson,
  492. (JobListIndexDepartmentList).toString(): JobListIndexDepartmentList.fromJson,
  493. (JobListIndexStatusList).toString(): JobListIndexStatusList.fromJson,
  494. (JobListIndexSGEntity).toString(): JobListIndexSGEntity.fromJson,
  495. (JobListIndexSGOption).toString(): JobListIndexSGOption.fromJson,
  496. (JobListRemarkViewEntity).toString(): JobListRemarkViewEntity.fromJson,
  497. (JobListSGEntity).toString(): JobListSGEntity.fromJson,
  498. (JobListSGRows).toString(): JobListSGRows.fromJson,
  499. (JobTemplateEditIndexEntity).toString(): JobTemplateEditIndexEntity.fromJson,
  500. (JobTemplateEditIndexAgeList).toString(): JobTemplateEditIndexAgeList.fromJson,
  501. (JobTemplateEditIndexSexList).toString(): JobTemplateEditIndexSexList.fromJson,
  502. (JobTemplateEditIndexLanguageList).toString(): JobTemplateEditIndexLanguageList.fromJson,
  503. (JobTemplateSGEntity).toString(): JobTemplateSGEntity.fromJson,
  504. (JobTemplateSGRows).toString(): JobTemplateSGRows.fromJson,
  505. (JobTitleEditIndexEntity).toString(): JobTitleEditIndexEntity.fromJson,
  506. (JobTitleEditIndexTemplate).toString(): JobTitleEditIndexTemplate.fromJson,
  507. (JobTitleSGEntity).toString(): JobTitleSGEntity.fromJson,
  508. (JobTitleSGRows).toString(): JobTitleSGRows.fromJson,
  509. (LabourRequestEditIndexEntity).toString(): LabourRequestEditIndexEntity.fromJson,
  510. (LabourRequestEditIndexTemplateList).toString(): LabourRequestEditIndexTemplateList.fromJson,
  511. (LabourRequestEditIndexDepartmentList).toString(): LabourRequestEditIndexDepartmentList.fromJson,
  512. (LabourRequestIndexEntity).toString(): LabourRequestIndexEntity.fromJson,
  513. (LabourRequestIndexDepartmentList).toString(): LabourRequestIndexDepartmentList.fromJson,
  514. (LabourRequestIndexStatusList).toString(): LabourRequestIndexStatusList.fromJson,
  515. (LabourRequestListEntity).toString(): LabourRequestListEntity.fromJson,
  516. (LabourRequestListRows).toString(): LabourRequestListRows.fromJson,
  517. (LabourRequestSGAddIndexEntity).toString(): LabourRequestSGAddIndexEntity.fromJson,
  518. (LabourRequestSGAddIndexOption).toString(): LabourRequestSGAddIndexOption.fromJson,
  519. (LabourRequestSGEntity).toString(): LabourRequestSGEntity.fromJson,
  520. (LabourRequestSGCountList).toString(): LabourRequestSGCountList.fromJson,
  521. (LabourRequestWorkFlowEntity).toString(): LabourRequestWorkFlowEntity.fromJson,
  522. (LabourRequestWorkFlowRecords).toString(): LabourRequestWorkFlowRecords.fromJson,
  523. (StaffDetailEntity).toString(): StaffDetailEntity.fromJson,
  524. (StaffDetailSGEntity).toString(): StaffDetailSGEntity.fromJson,
  525. (StaffDetailSGReviews).toString(): StaffDetailSGReviews.fromJson,
  526. (StaffDetailSGReviewsReviews).toString(): StaffDetailSGReviewsReviews.fromJson,
  527. (StaffJobHistorySGEntity).toString(): StaffJobHistorySGEntity.fromJson,
  528. (StaffJobHistorySGRows).toString(): StaffJobHistorySGRows.fromJson,
  529. (StaffLabourHistoryEntity).toString(): StaffLabourHistoryEntity.fromJson,
  530. (StaffLabourHistoryRows).toString(): StaffLabourHistoryRows.fromJson,
  531. (StaffLabourHistoryRowsSecurityIn).toString(): StaffLabourHistoryRowsSecurityIn.fromJson,
  532. (StaffLabourHistoryRowsSecurityOut).toString(): StaffLabourHistoryRowsSecurityOut.fromJson,
  533. (StaffLabourHistoryRowsWorkIn).toString(): StaffLabourHistoryRowsWorkIn.fromJson,
  534. (StaffLabourHistoryRowsWorkOut).toString(): StaffLabourHistoryRowsWorkOut.fromJson,
  535. (StaffRemarkHistoryEntity).toString(): StaffRemarkHistoryEntity.fromJson,
  536. (StaffRemarkHistoryRows).toString(): StaffRemarkHistoryRows.fromJson,
  537. (StaffReviewHistorySGEntity).toString(): StaffReviewHistorySGEntity.fromJson,
  538. (StaffReviewHistorySGReviews).toString(): StaffReviewHistorySGReviews.fromJson,
  539. (ServerTime).toString(): ServerTime.fromJson,
  540. };
  541. bool containsKey(String type) {
  542. return convertFuncMap.containsKey(type);
  543. }
  544. JsonConvertFunction? operator [](String key) {
  545. return convertFuncMap[key];
  546. }
  547. }