diff --git a/analysis_options.yaml b/analysis_options.yaml index fa4efae..a84033c 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -14,6 +14,10 @@ analyzer: always_use_package_imports: error camel_case_types: error always_declare_return_types: error + null_check_on_nullable_type_parameter: error + avoid_annotating_with_dynamic: error + unnecessary_null_checks: error + unnecessary_brace_in_string_interps: error linter: @@ -36,11 +40,15 @@ linter: unnecessary_this: true unnecessary_new: true camel_case_types: true + null_check_on_nullable_type_parameter: true sort_child_properties_last: true - camel_case_extensions : true + camel_case_extensions: true require_trailing_commas: true avoid_empty_else: true avoid_annotating_with_dynamic: true + unnecessary_null_checks: true + unnecessary_brace_in_string_interps: true + unnecessary_string_interpolations: true # avoid_print: false # Uncomment to disable the `avoid_print` rule # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule diff --git a/lib/api/api_client.dart b/lib/api/api_client.dart index f4d5f30..2f53f78 100644 --- a/lib/api/api_client.dart +++ b/lib/api/api_client.dart @@ -8,6 +8,7 @@ import 'package:http/io_client.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/exceptions/api_exception.dart'; import 'package:mohem_flutter_app/main.dart'; +// ignore_for_file: avoid_annotating_with_dynamic typedef FactoryConstructor = U Function(dynamic); diff --git a/lib/classes/utils.dart b/lib/classes/utils.dart index 424d656..292bc4c 100644 --- a/lib/classes/utils.dart +++ b/lib/classes/utils.dart @@ -8,8 +8,6 @@ import 'package:fluttertoast/fluttertoast.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/config/routes.dart'; - -// import 'package:fluttertoast/fluttertoast.dart'; import 'package:mohem_flutter_app/exceptions/api_exception.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; @@ -18,7 +16,7 @@ import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/widgets/dialogs/confirm_dialog.dart'; import 'package:mohem_flutter_app/widgets/loading_dialog.dart'; import 'package:shared_preferences/shared_preferences.dart'; -import 'package:sizer/sizer.dart'; +// ignore_for_file: avoid_annotating_with_dynamic class Utils { static bool _isLoadingVisible = false; diff --git a/lib/ui/attendance/monthly_attendance.dart b/lib/ui/attendance/monthly_attendance.dart index 70afd40..de5c9c9 100644 --- a/lib/ui/attendance/monthly_attendance.dart +++ b/lib/ui/attendance/monthly_attendance.dart @@ -327,7 +327,7 @@ class _MonthlyAttendanceState extends State { ), alignment: Alignment.center, child: Text( - "${val}", + "$val", style: const TextStyle( fontSize: 13, fontWeight: FontWeight.w500, @@ -358,7 +358,7 @@ class _MonthlyAttendanceState extends State { ), alignment: Alignment.center, child: Text( - "${val}", + "$val", style: const TextStyle( fontSize: 13, fontWeight: FontWeight.w500, @@ -384,7 +384,7 @@ class _MonthlyAttendanceState extends State { ), alignment: Alignment.center, child: Text( - "${val}", + "$val", style: const TextStyle( fontSize: 13, fontWeight: FontWeight.w500, @@ -408,7 +408,7 @@ class _MonthlyAttendanceState extends State { ), alignment: Alignment.center, child: Text( - "${val}", + "$val", style: const TextStyle( fontSize: 13, fontWeight: FontWeight.w500, diff --git a/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart b/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart index 9f24023..cc7c3aa 100644 --- a/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart +++ b/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart @@ -124,7 +124,7 @@ class _DynamicInputScreenState extends State { Utils.showLoading(context); for (int i = 0; i < (structureList.cHILDSEGMENTSDVSplited?.length ?? 0); i++) { String segmentId = structureList.cHILDSEGMENTSDVSplited![i]; - print("segmentId:${segmentId}"); + print("segmentId:$segmentId"); print("segmentName:${structureList.sEGMENTNAME}"); GetEITDFFStructureList? parent = getEitDffStructureList!.firstWhere((element) => element.sEGMENTNAME == segmentId); List parentRequired = parent.pARENTSEGMENTSDVSplited ?? []; @@ -138,7 +138,7 @@ class _DynamicInputScreenState extends State { sEGMENTNAME: e.sEGMENTNAME, vALUECOLUMNNAME: e.eSERVICESDV!.pVALUECOLUMNNAME, dESCRIPTION: "", iDCOLUMNNAME: e.eSERVICESDV!.pIDCOLUMNNAME, fLEXVALUESETNAME: e.fLEXVALUESETNAME) .toJson()) .toList(); - print("values:${values}"); + print("values:$values"); ESERVICESDV defaultValue = await MyAttendanceApiClient().getDefaultValue(segmentId, structureList.dESCFLEXCONTEXTCODE!, structureList.dESCFLEXNAME!, values); int index = getEitDffStructureList!.indexWhere((element) => element.sEGMENTNAME == segmentId); diff --git a/lib/ui/profile/basic_details.dart b/lib/ui/profile/basic_details.dart index 2b5c42b..6650703 100644 --- a/lib/ui/profile/basic_details.dart +++ b/lib/ui/profile/basic_details.dart @@ -95,22 +95,22 @@ class _BasicDetailsState extends State { ), child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ LocaleKeys.fullName.tr().toText13(color: MyColors.lightGrayColor), - "${fullName}".toText16(isBold: true, color: MyColors.blackColor), + "$fullName".toText16(isBold: true, color: MyColors.blackColor), SizedBox( height: 20, ), LocaleKeys.maritalStatus.tr().toText13(color: MyColors.lightGrayColor), - "${maritalStatus}".toText16(isBold: true, color: MyColors.blackColor), + "$maritalStatus".toText16(isBold: true, color: MyColors.blackColor), SizedBox( height: 20, ), LocaleKeys.dateOfBirth.tr().toText13(color: MyColors.lightGrayColor), - "${birthDate}".toText16(isBold: true, color: MyColors.blackColor), + "$birthDate".toText16(isBold: true, color: MyColors.blackColor), SizedBox( height: 20, ), LocaleKeys.civilIdentityNumber.tr().toText13(color: MyColors.lightGrayColor), - "${civilIdentityNumber}".toText16(isBold: true, color: MyColors.blackColor), + "$civilIdentityNumber".toText16(isBold: true, color: MyColors.blackColor), ]), ), ], diff --git a/lib/ui/profile/dynamic_screens/dynamic_input_basic_details_screen.dart b/lib/ui/profile/dynamic_screens/dynamic_input_basic_details_screen.dart index ed37610..a2f3e40 100644 --- a/lib/ui/profile/dynamic_screens/dynamic_input_basic_details_screen.dart +++ b/lib/ui/profile/dynamic_screens/dynamic_input_basic_details_screen.dart @@ -182,7 +182,7 @@ class _DynamicInputScreenState extends State { for (int i = 0; i < model.eSERVICESVS!.length; i++) PopupMenuItem(child: Text(model.eSERVICESVS![i].vALUECOLUMNNAME!), value: i), ], onSelected: (int popupIndex) { - getBasicDetDffStructureList![index].userBasicDetail!.sEGMENTVALUEDSP = model.eSERVICESVS![popupIndex].vALUECOLUMNNAME!; + getBasicDetDffStructureList![index].userBasicDetail!.sEGMENTVALUEDSP = model.eSERVICESVS![popupIndex].vALUECOLUMNNAME; setState(() {}); }); } @@ -246,8 +246,8 @@ class _DynamicInputScreenState extends State { ], onSelected: (int popupIndex) { ESERVICESDV eservicesdv = - ESERVICESDV(pIDCOLUMNNAME: model.objectValuesList![popupIndex].mEANING, pRETURNMSG: "null", pRETURNSTATUS: model.oBJECTNAME, pVALUECOLUMNNAME: model.aPPLICATIONCOLUMNNAME); - getBasicDetColsStructureList![index].userBasicDetail!.sEGMENTVALUEDSP = model.objectValuesList![popupIndex].mEANING!; + ESERVICESDV(pIDCOLUMNNAME: model.objectValuesList![index].dESCRIPTION, pRETURNMSG: "null", pRETURNSTATUS: model.oBJECTNAME, pVALUECOLUMNNAME: model.aPPLICATIONCOLUMNNAME); + getBasicDetDffStructureList![index].userBasicDetail!.sEGMENTVALUEDSP = model.objectValuesList![popupIndex].dESCRIPTION; setState(() {}); }); } diff --git a/lib/ui/screens/mowadhafhi/mowadhafhi_hr_request.dart b/lib/ui/screens/mowadhafhi/mowadhafhi_hr_request.dart index 6ed9cb5..4ee819d 100644 --- a/lib/ui/screens/mowadhafhi/mowadhafhi_hr_request.dart +++ b/lib/ui/screens/mowadhafhi/mowadhafhi_hr_request.dart @@ -95,7 +95,6 @@ class _MowadhafhiHRRequestState extends State { groupValue: selectedServiceType, selectedColor: MyColors.gradiantStartColor), ).onPress(() { - debugPrint(getTicketTypesList[index].typeName!); selectedServiceType = getTicketTypesList[index].ticketTypeId!.toString(); setState(() {}); }); @@ -314,7 +313,7 @@ class _MowadhafhiHRRequestState extends State { getMowadhafhiProjectsList = await MowadhafhiApiClient().getProjects(); Utils.hideLoading(context); getProjectDepartments(getMowadhafhiProjectsList[0].projectId!); - projectID = getMowadhafhiProjectsList[0].projectId!; + projectID = getMowadhafhiProjectsList[0].projectId; } catch (ex) { Utils.hideLoading(context); Utils.handleException(ex, context, null); diff --git a/lib/ui/screens/pending_transactions/pending_transactions.dart b/lib/ui/screens/pending_transactions/pending_transactions.dart index e074ad7..98d7fe3 100644 --- a/lib/ui/screens/pending_transactions/pending_transactions.dart +++ b/lib/ui/screens/pending_transactions/pending_transactions.dart @@ -76,7 +76,7 @@ class _PendingTransactionsState extends State { for (int i = 0; i < getPendingTransactionsFunctions!.length; i++) PopupMenuItem(child: Text(getPendingTransactionsFunctions![i].fUNCTIONPROMPT!), value: i), ], onSelected: (int popupIndex) { - selectedFunction = getPendingTransactionsFunctions![popupIndex]; + selectedFunction = getPendingTransactionsFunctions[popupIndex]; setState(() {}); }), 12.height, diff --git a/lib/ui/work_list/worklist_detail_screen.dart b/lib/ui/work_list/worklist_detail_screen.dart index 1166d83..6ad0a79 100644 --- a/lib/ui/work_list/worklist_detail_screen.dart +++ b/lib/ui/work_list/worklist_detail_screen.dart @@ -485,7 +485,7 @@ class _WorkListDetailScreenState extends State { "P_APPROVER_INDEX": null, "P_COMMENTS": "", "P_FORWARD_TO_USER_NAME": "", - "P_NOTIFICATION_ID": workListData!.nOTIFICATIONID!, + "P_NOTIFICATION_ID": workListData!.nOTIFICATIONID, "RespondAttributeList": [ if (notificationNoteInput != null) {notificationNoteInput!.attributeName: note} ],