From 83ed9af5a99999a71af38063054713fb9ce2a0ce Mon Sep 17 00:00:00 2001 From: Neha Musale <70088044+Neha62-lit@users.noreply.github.com> Date: Fri, 15 Oct 2021 22:39:13 +0530 Subject: [PATCH] fix(lints): prefer_typing_uninitialized_variables rule (#161) * fix(lints): prefer_typing_uninitialized_variables rule * fix(lints): prefer_typing_uninitialized_variables rule * Formatted the code --- 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 | 5 +++-- 6 files changed, 8 insertions(+), 18 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..3435e68c 100644 --- a/lib/utils/app_exceptions.dart +++ b/lib/utils/app_exceptions.dart @@ -1,6 +1,7 @@ class AppException implements Exception { - final _message; - final _prefix; + final String _message; + + final String _prefix; AppException([this._message, this._prefix]);