From 2b4dbdbcf6b0c31db50068c9658967ae5c34241b Mon Sep 17 00:00:00 2001 From: Neha Musale Date: Fri, 15 Oct 2021 16:51:53 +0530 Subject: [PATCH 1/3] fix(lints): prefer_typing_uninitialized_variables rule --- analysis_options.yaml | 11 ----------- lib/services/ib_engine_service.dart | 4 ++-- lib/ui/views/groups/add_assignment_view.dart | 2 +- lib/ui/views/groups/update_assignment_view.dart | 2 +- lib/ui/views/ib/syntaxes/ib_liquid_syntax.dart | 2 +- lib/utils/app_exceptions.dart | 2 ++ 6 files changed, 7 insertions(+), 16 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index 4f32c7ab..6f2025e1 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -16,15 +16,6 @@ linter: avoid_redundant_argument_values: false - # Unnecessary use of this in constructors should not be done - unnecessary_this: false - - leading_newlines_in_multiline_strings: false - - type_annotate_public_apis: false - - directives_ordering: false - avoid_function_literals_in_foreach_calls: false join_return_with_assignment: false @@ -32,5 +23,3 @@ linter: non_constant_identifier_names: false constant_identifier_names: false - - prefer_typing_uninitialized_variables: false diff --git a/lib/services/ib_engine_service.dart b/lib/services/ib_engine_service.dart index 4f0ac783..db2c21dc 100644 --- a/lib/services/ib_engine_service.dart +++ b/lib/services/ib_engine_service.dart @@ -53,7 +53,7 @@ class IbEngineServiceImpl implements IbEngineService { bool ignoreIndex = false, }) async { /// Fetch response from API for the given id - var _apiResponse; + List> _apiResponse; try { _apiResponse = await _ibApi.fetchApiPage(id: id); } catch (_) { @@ -138,7 +138,7 @@ class IbEngineServiceImpl implements IbEngineService { return _ibChapters; } - var _chapters; + List _chapters; try { _chapters = await _fetchPagesInDir(ignoreIndex: true); } on Failure catch (e) { diff --git a/lib/ui/views/groups/add_assignment_view.dart b/lib/ui/views/groups/add_assignment_view.dart index 48d32fde..14e65a00 100644 --- a/lib/ui/views/groups/add_assignment_view.dart +++ b/lib/ui/views/groups/add_assignment_view.dart @@ -207,7 +207,7 @@ class _AddAssignmentViewState extends State { _dialogService.showCustomProgressDialog(title: 'Adding..'); // [ISSUE] [html_editor] Throws error in Tests - var _descriptionEditorText; + String _descriptionEditorText; try { _descriptionEditorText = await _descriptionEditor.currentState.getText(); diff --git a/lib/ui/views/groups/update_assignment_view.dart b/lib/ui/views/groups/update_assignment_view.dart index 6ce9eced..60df3834 100644 --- a/lib/ui/views/groups/update_assignment_view.dart +++ b/lib/ui/views/groups/update_assignment_view.dart @@ -186,7 +186,7 @@ class _UpdateAssignmentViewState extends State { _dialogService.showCustomProgressDialog(title: 'Updating..'); // [ISSUE] [html_editor] Throws error in Tests - var _descriptionEditorText; + String _descriptionEditorText; try { _descriptionEditorText = await _descriptionEditor.currentState.getText(); diff --git a/lib/ui/views/ib/syntaxes/ib_liquid_syntax.dart b/lib/ui/views/ib/syntaxes/ib_liquid_syntax.dart index 49cbee2a..90ae68e6 100644 --- a/lib/ui/views/ib/syntaxes/ib_liquid_syntax.dart +++ b/lib/ui/views/ib/syntaxes/ib_liquid_syntax.dart @@ -8,7 +8,7 @@ class IbLiquidSyntax extends md.BlockSyntax { md.Node parse(md.BlockParser parser) { var match = pattern.firstMatch(parser.current); var tags = match[1].split(' '); - var node; + md.Element node; // Liquid include tags if (tags[0] == 'include') { diff --git a/lib/utils/app_exceptions.dart b/lib/utils/app_exceptions.dart index 5ef1fd0e..f116a318 100644 --- a/lib/utils/app_exceptions.dart +++ b/lib/utils/app_exceptions.dart @@ -1,5 +1,7 @@ class AppException implements Exception { + // ignore: prefer_typing_uninitialized_variables final _message; + // ignore: prefer_typing_uninitialized_variables final _prefix; AppException([this._message, this._prefix]); From 02f1e75586565de394eb6d0df20238aa3feb70e0 Mon Sep 17 00:00:00 2001 From: Neha Musale Date: Fri, 15 Oct 2021 17:15:51 +0530 Subject: [PATCH 2/3] fix(lints): prefer_typing_uninitialized_variables rule --- lib/utils/app_exceptions.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/utils/app_exceptions.dart b/lib/utils/app_exceptions.dart index f116a318..098ee3bd 100644 --- a/lib/utils/app_exceptions.dart +++ b/lib/utils/app_exceptions.dart @@ -1,8 +1,8 @@ class AppException implements Exception { - // ignore: prefer_typing_uninitialized_variables - final _message; - // ignore: prefer_typing_uninitialized_variables - final _prefix; + + final String _message; + + final String _prefix; AppException([this._message, this._prefix]); From 043e67eaeea1378b0029a426952b14beed1fcc89 Mon Sep 17 00:00:00 2001 From: Neha Musale Date: Fri, 15 Oct 2021 17:23:11 +0530 Subject: [PATCH 3/3] Formatted the code --- lib/utils/app_exceptions.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/utils/app_exceptions.dart b/lib/utils/app_exceptions.dart index 098ee3bd..3435e68c 100644 --- a/lib/utils/app_exceptions.dart +++ b/lib/utils/app_exceptions.dart @@ -1,5 +1,4 @@ class AppException implements Exception { - final String _message; final String _prefix;