Add some more new lints (#91659)

This commit is contained in:
Ian Hickson 2021-10-12 11:33:04 -07:00 committed by GitHub
parent bb5cbdc635
commit 66dd2add7e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 2 deletions

View file

@ -112,6 +112,7 @@ linter:
- empty_catches
- empty_constructor_bodies
- empty_statements
- eol_at_end_of_file
- exhaustive_cases
- file_names
- flutter_style_todos
@ -162,6 +163,7 @@ linter:
- prefer_final_fields
- prefer_final_in_for_each
- prefer_final_locals
# - prefer_final_parameters # we should enable this one day (see also parameter_assignments)
- prefer_for_elements_to_map_fromIterable
- prefer_foreach
- prefer_function_declarations_over_variables
@ -178,6 +180,7 @@ linter:
- prefer_iterable_whereType
# - prefer_mixin # Has false positives, see https://github.com/dart-lang/linter/issues/3018
- prefer_null_aware_operators
# - prefer_null_aware_method_calls # "call()" is confusing to people new to the language since it's not documented anywhere
- prefer_relative_imports
- prefer_single_quotes
- prefer_spread_collections
@ -186,6 +189,7 @@ linter:
- provide_deprecation_message
# - public_member_api_docs # enabled on a case-by-case basis; see e.g. packages/analysis_options.yaml
- recursive_getters
# - require_trailing_commas # blocked on https://github.com/dart-lang/sdk/issues/47441
- sized_box_for_whitespace
- slash_for_doc_comments
- sort_child_properties_last
@ -201,6 +205,7 @@ linter:
- unnecessary_await_in_return
- unnecessary_brace_in_string_interps
- unnecessary_const
- unnecessary_constructor_name
# - unnecessary_final # conflicts with prefer_final_locals
- unnecessary_getters_setters
# - unnecessary_lambdas # has false positives: https://github.com/dart-lang/linter/issues/498
@ -218,6 +223,7 @@ linter:
- unnecessary_this
- unrelated_type_equality_checks
# - unsafe_html # not yet tested
- use_build_context_synchronously
- use_full_hex_values_for_flutter_colors
- use_function_type_syntax_for_parameters
# - use_if_null_to_convert_nulls_to_bools # not yet tested

View file

@ -181,8 +181,14 @@ class MotionEventsBodyState extends State<MotionEventsBody> {
// This test only runs on Android so we can assume path separator is '/'.
final File file = File('${outDir?.path}/$kEventsFileName');
await file.writeAsBytes(data.buffer.asUint8List(0, data.lengthInBytes), flush: true);
if (!mounted) {
return;
}
showMessage(context, 'Saved original events to ${file.path}');
} catch (e) {
if (!mounted) {
return;
}
showMessage(context, 'Failed saving ${e.toString()}');
}
}

View file

@ -163,8 +163,14 @@ class MotionEventsBodyState extends State<MotionEventsBody> {
// This test only runs on Android so we can assume path separator is '/'.
final File file = File('${outDir.path}/$kEventsFileName');
await file.writeAsBytes(data.buffer.asUint8List(0, data.lengthInBytes), flush: true);
if (!mounted) {
return;
}
showMessage(context, 'Saved original events to ${file.path}');
} catch (e) {
if (!mounted) {
return;
}
showMessage(context, 'Failed saving ${e.toString()}');
}
}

View file

@ -649,4 +649,4 @@ class FakeSceneBuilder extends Fake implements SceneBuilder {
class FakeOpacityEngineLayer extends FakeEngineLayer implements OpacityEngineLayer {}
class FakeOffsetEngineLayer extends FakeEngineLayer implements OffsetEngineLayer {}
class FakeOffsetEngineLayer extends FakeEngineLayer implements OffsetEngineLayer {}

View file

@ -95,4 +95,4 @@ void main() {
});
}
class TestException implements Exception {}
class TestException implements Exception {}