From 0a136edb8667255ec8c392b2a007d2d718b570ba Mon Sep 17 00:00:00 2001 From: Till Friebe Date: Thu, 8 Apr 2021 20:29:01 +0200 Subject: [PATCH] Avoid void async When declaring an async method or function which does not return a value, declare that it returns Future and not just void. --- analysis_options.yaml | 3 ++- lib/widgets/editor.dart | 2 +- lib/widgets/raw_editor.dart | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index a7b7b075..b00ad5ad 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -13,6 +13,8 @@ linter: - avoid_escaping_inner_quotes - avoid_print - avoid_redundant_argument_values + - avoid_types_on_closure_parameters + - avoid_void_async - directives_ordering - omit_local_variable_types - prefer_const_constructors @@ -24,4 +26,3 @@ linter: - prefer_relative_imports - prefer_single_quotes - unnecessary_parenthesis - - avoid_types_on_closure_parameters diff --git a/lib/widgets/editor.dart b/lib/widgets/editor.dart index f1faaec6..1b92dece 100644 --- a/lib/widgets/editor.dart +++ b/lib/widgets/editor.dart @@ -427,7 +427,7 @@ class _QuillEditorSelectionGestureDetectorBuilder return true; } - void _launchUrl(String url) async { + Future _launchUrl(String url) async { await launch(url); } diff --git a/lib/widgets/raw_editor.dart b/lib/widgets/raw_editor.dart index 9747901f..fc07a110 100644 --- a/lib/widgets/raw_editor.dart +++ b/lib/widgets/raw_editor.dart @@ -806,7 +806,7 @@ class RawEditorState extends EditorState ); } - void handleShortcut(InputShortcut? shortcut) async { + Future handleShortcut(InputShortcut? shortcut) async { final selection = widget.controller.selection; final plainText = textEditingValue.text; if (shortcut == InputShortcut.COPY) { @@ -1058,7 +1058,7 @@ class RawEditorState extends EditorState } } - void __setEditingValue(TextEditingValue value) async { + Future __setEditingValue(TextEditingValue value) async { if (await __isItCut(value)) { widget.controller.replaceText( textEditingValue.selection.start,