diff --git a/analysis_options.yaml b/analysis_options.yaml index fd050940785..2efe08aae48 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -223,6 +223,7 @@ linter: - unnecessary_constructor_name # - unnecessary_final # conflicts with prefer_final_locals - unnecessary_getters_setters + # - unnecessary_ignore # Disabled by default to simplify migrations; should be periodically enabled locally to clean up offenders # - unnecessary_lambdas # has false positives: https://github.com/dart-lang/linter/issues/498 - unnecessary_late - unnecessary_library_directive diff --git a/dev/a11y_assessments/test/home_page_test.dart b/dev/a11y_assessments/test/home_page_test.dart index d091886a887..344bcb9fad3 100644 --- a/dev/a11y_assessments/test/home_page_test.dart +++ b/dev/a11y_assessments/test/home_page_test.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// ignore_for_file: avoid_dynamic_calls - import 'package:a11y_assessments/main.dart'; import 'package:a11y_assessments/use_cases/action_chip.dart'; import 'package:a11y_assessments/use_cases/auto_complete.dart'; diff --git a/dev/devicelab/bin/tasks/build_android_host_app_with_module_aar.dart b/dev/devicelab/bin/tasks/build_android_host_app_with_module_aar.dart index b60ef04bbae..80a5b322768 100644 --- a/dev/devicelab/bin/tasks/build_android_host_app_with_module_aar.dart +++ b/dev/devicelab/bin/tasks/build_android_host_app_with_module_aar.dart @@ -437,7 +437,6 @@ class ModuleTest { Future main() async { await task( combine([ - // ignore: avoid_redundant_argument_values ModuleTest(gradleVersion: '8.4').call, ModuleTest(gradleVersion: '8.4-rc-3').call, ]), diff --git a/dev/devicelab/bin/tasks/build_android_host_app_with_module_source.dart b/dev/devicelab/bin/tasks/build_android_host_app_with_module_source.dart index eb6e76e5485..c9ab35b97bc 100644 --- a/dev/devicelab/bin/tasks/build_android_host_app_with_module_source.dart +++ b/dev/devicelab/bin/tasks/build_android_host_app_with_module_source.dart @@ -407,10 +407,5 @@ class ModuleTest { } Future main() async { - await task( - combine([ - // ignore: avoid_redundant_argument_values - ModuleTest(gradleVersion: '8.7').call, - ]), - ); + await task(combine([ModuleTest(gradleVersion: '8.7').call])); } diff --git a/dev/integration_tests/display_cutout_rotation/test_driver/display_cutout_test_test.dart b/dev/integration_tests/display_cutout_rotation/test_driver/display_cutout_test_test.dart index e8ca40aa998..2dea8af05e8 100644 --- a/dev/integration_tests/display_cutout_rotation/test_driver/display_cutout_test_test.dart +++ b/dev/integration_tests/display_cutout_rotation/test_driver/display_cutout_test_test.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// ignore_for_file: avoid_print - import 'dart:async'; import 'dart:convert'; import 'dart:io'; diff --git a/dev/integration_tests/link_hook/lib/link_hook_bindings_generated.dart b/dev/integration_tests/link_hook/lib/link_hook_bindings_generated.dart index c677d2ddcc7..9a53b2b4038 100644 --- a/dev/integration_tests/link_hook/lib/link_hook_bindings_generated.dart +++ b/dev/integration_tests/link_hook/lib/link_hook_bindings_generated.dart @@ -2,10 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// ignore_for_file: always_specify_types -// ignore_for_file: camel_case_types -// ignore_for_file: non_constant_identifier_names - // AUTO GENERATED FILE, DO NOT EDIT. // // Generated by `package:ffigen`. diff --git a/dev/integration_tests/new_gallery/lib/data/demos.dart b/dev/integration_tests/new_gallery/lib/data/demos.dart index 542a73a37b1..e15b43995af 100644 --- a/dev/integration_tests/new_gallery/lib/data/demos.dart +++ b/dev/integration_tests/new_gallery/lib/data/demos.dart @@ -1036,11 +1036,7 @@ class Demos { description: localizations.demoCupertinoPickerDescription, documentationUrl: '$_docsBaseUrl/cupertino/CupertinoDatePicker-class.html', buildRoute: - (_) => DeferredWidget( - cupertinoLoader, - // ignore: prefer_const_constructors - () => cupertino_demos.CupertinoPickerDemo(), - ), + (_) => DeferredWidget(cupertinoLoader, () => cupertino_demos.CupertinoPickerDemo()), ), ], category: GalleryDemoCategory.cupertino, @@ -1056,11 +1052,8 @@ class Demos { description: localizations.demoCupertinoScrollbarDescription, documentationUrl: '$_docsBaseUrl/cupertino/CupertinoScrollbar-class.html', buildRoute: - (_) => DeferredWidget( - cupertinoLoader, - // ignore: prefer_const_constructors - () => cupertino_demos.CupertinoScrollbarDemo(), - ), + (_) => + DeferredWidget(cupertinoLoader, () => cupertino_demos.CupertinoScrollbarDemo()), ), ], category: GalleryDemoCategory.cupertino, diff --git a/dev/integration_tests/new_gallery/lib/routes.dart b/dev/integration_tests/new_gallery/lib/routes.dart index 25d2eb2582a..b56d6f0ef1c 100644 --- a/dev/integration_tests/new_gallery/lib/routes.dart +++ b/dev/integration_tests/new_gallery/lib/routes.dart @@ -55,28 +55,20 @@ class RouteConfiguration { ), Path( r'^' + rally_routes.homeRoute, - (BuildContext context, String? match) => StudyWrapper( - study: DeferredWidget( - rally.loadLibrary, - () => rally.RallyApp(), - ), // ignore: prefer_const_constructors - ), + (BuildContext context, String? match) => + StudyWrapper(study: DeferredWidget(rally.loadLibrary, () => rally.RallyApp())), ), Path( r'^' + shrine_routes.homeRoute, - (BuildContext context, String? match) => StudyWrapper( - study: DeferredWidget( - shrine.loadLibrary, - () => shrine.ShrineApp(), - ), // ignore: prefer_const_constructors - ), + (BuildContext context, String? match) => + StudyWrapper(study: DeferredWidget(shrine.loadLibrary, () => shrine.ShrineApp())), ), Path( r'^' + crane_routes.defaultRoute, (BuildContext context, String? match) => StudyWrapper( study: DeferredWidget( crane.loadLibrary, - () => crane.CraneApp(), // ignore: prefer_const_constructors + () => crane.CraneApp(), placeholder: const DeferredLoadingPlaceholder(name: 'Crane'), ), ), @@ -84,16 +76,11 @@ class RouteConfiguration { Path( r'^' + fortnightly_routes.defaultRoute, (BuildContext context, String? match) => StudyWrapper( - study: DeferredWidget( - fortnightly.loadLibrary, - // ignore: prefer_const_constructors - () => fortnightly.FortnightlyApp(), - ), + study: DeferredWidget(fortnightly.loadLibrary, () => fortnightly.FortnightlyApp()), ), ), Path( r'^' + reply_routes.homeRoute, - // ignore: prefer_const_constructors (BuildContext context, String? match) => const StudyWrapper(study: reply.ReplyApp(), hasBottomNavBar: true), ), diff --git a/dev/snippets/lib/src/util.dart b/dev/snippets/lib/src/util.dart index b509e8b106d..5c3fe74655a 100644 --- a/dev/snippets/lib/src/util.dart +++ b/dev/snippets/lib/src/util.dart @@ -263,7 +263,6 @@ SampleStats getSampleStats(SourceElement element) { /// Exit the app with a message to stderr. /// Can be overridden by tests to avoid exits. -// ignore: prefer_function_declarations_over_variables void Function(String message) errorExit = (String message) { io.stderr.writeln(message); io.exit(1); diff --git a/engine/src/flutter/lib/ui/geometry.dart b/engine/src/flutter/lib/ui/geometry.dart index 76fce9abf34..5d9a7cb695a 100644 --- a/engine/src/flutter/lib/ui/geometry.dart +++ b/engine/src/flutter/lib/ui/geometry.dart @@ -357,7 +357,7 @@ class Size extends OffsetBase { /// /// * [Size.fromRadius], which is more convenient when the available size /// is the radius of a circle. - const Size.square(double dimension) : super(dimension, dimension); // ignore: use_super_parameters + const Size.square(double dimension) : super(dimension, dimension); /// Creates a [Size] with the given [width] and an infinite [height]. const Size.fromWidth(double width) : super(width, double.infinity); diff --git a/engine/src/flutter/lib/ui/natives.dart b/engine/src/flutter/lib/ui/natives.dart index 65d758977e0..e67bdcb7a35 100644 --- a/engine/src/flutter/lib/ui/natives.dart +++ b/engine/src/flutter/lib/ui/natives.dart @@ -3,8 +3,6 @@ // found in the LICENSE file. part of dart.ui; -// ignore_for_file: avoid_classes_with_only_static_members - /// Helper functions for Dart Plugin Registrants. abstract final class DartPluginRegistrant { static bool _wasInitialized = false; diff --git a/engine/src/flutter/lib/web_ui/dev/firefox.dart b/engine/src/flutter/lib/web_ui/dev/firefox.dart index 17dc298dc8b..a1e7b7951ca 100644 --- a/engine/src/flutter/lib/web_ui/dev/firefox.dart +++ b/engine/src/flutter/lib/web_ui/dev/firefox.dart @@ -7,8 +7,7 @@ import 'dart:io'; import 'package:path/path.dart' as path; import 'package:test_api/backend.dart'; -// TODO(ditman): Fix ignore when https://github.com/flutter/flutter/issues/143599 is resolved. -import 'package:test_core/src/util/io.dart'; // ignore: implementation_imports +import 'package:test_core/src/util/io.dart'; import 'browser.dart'; import 'browser_process.dart'; diff --git a/engine/src/flutter/lib/web_ui/dev/steps/run_suite_step.dart b/engine/src/flutter/lib/web_ui/dev/steps/run_suite_step.dart index 1cc01ea1140..31a606c68ca 100644 --- a/engine/src/flutter/lib/web_ui/dev/steps/run_suite_step.dart +++ b/engine/src/flutter/lib/web_ui/dev/steps/run_suite_step.dart @@ -10,10 +10,8 @@ import 'package:path/path.dart' as pathlib; // https://github.com/dart-lang/test/issues/1521 import 'package:skia_gold_client/skia_gold_client.dart'; import 'package:test_api/backend.dart' as hack; -// TODO(ditman): Fix ignores when https://github.com/flutter/flutter/issues/143599 is resolved. -import 'package:test_core/src/executable.dart' as test; // ignore: implementation_imports -import 'package:test_core/src/runner/hack_register_platform.dart' - as hack; // ignore: implementation_imports +import 'package:test_core/src/executable.dart' as test; +import 'package:test_core/src/runner/hack_register_platform.dart' as hack; import '../browser.dart'; import '../common.dart'; diff --git a/engine/src/flutter/lib/web_ui/dev/test_platform.dart b/engine/src/flutter/lib/web_ui/dev/test_platform.dart index d5f0635e085..7aef88633a7 100644 --- a/engine/src/flutter/lib/web_ui/dev/test_platform.dart +++ b/engine/src/flutter/lib/web_ui/dev/test_platform.dart @@ -23,13 +23,12 @@ import 'package:skia_gold_client/skia_gold_client.dart'; import 'package:stream_channel/stream_channel.dart'; import 'package:test_core/backend.dart' hide Compiler; -// TODO(ditman): Fix ignores when https://github.com/flutter/flutter/issues/143599 is resolved. -import 'package:test_core/src/runner/environment.dart'; // ignore: implementation_imports -import 'package:test_core/src/runner/platform.dart'; // ignore: implementation_imports -import 'package:test_core/src/runner/plugin/platform_helpers.dart'; // ignore: implementation_imports -import 'package:test_core/src/runner/runner_suite.dart'; // ignore: implementation_imports -import 'package:test_core/src/util/io.dart'; // ignore: implementation_imports -import 'package:test_core/src/util/stack_trace_mapper.dart'; // ignore: implementation_imports +import 'package:test_core/src/runner/environment.dart'; +import 'package:test_core/src/runner/platform.dart'; +import 'package:test_core/src/runner/plugin/platform_helpers.dart'; +import 'package:test_core/src/runner/runner_suite.dart'; +import 'package:test_core/src/util/io.dart'; +import 'package:test_core/src/util/stack_trace_mapper.dart'; import 'package:web_socket_channel/web_socket_channel.dart'; import 'package:web_test_utils/image_compare.dart'; diff --git a/engine/src/flutter/lib/web_ui/lib/geometry.dart b/engine/src/flutter/lib/web_ui/lib/geometry.dart index 31dd463c2ba..a9c152e9d7b 100644 --- a/engine/src/flutter/lib/web_ui/lib/geometry.dart +++ b/engine/src/flutter/lib/web_ui/lib/geometry.dart @@ -90,7 +90,7 @@ class Size extends OffsetBase { const Size(super.width, super.height); // Used by the rendering library's _DebugSize hack. Size.copy(Size source) : super(source.width, source.height); - const Size.square(double dimension) : super(dimension, dimension); // ignore: use_super_parameters + const Size.square(double dimension) : super(dimension, dimension); const Size.fromWidth(double width) : super(width, double.infinity); const Size.fromHeight(double height) : super(double.infinity, height); const Size.fromRadius(double radius) : super(radius * 2.0, radius * 2.0); diff --git a/engine/src/flutter/lib/web_ui/lib/natives.dart b/engine/src/flutter/lib/web_ui/lib/natives.dart index 5e61e40b616..56ed3c85396 100644 --- a/engine/src/flutter/lib/web_ui/lib/natives.dart +++ b/engine/src/flutter/lib/web_ui/lib/natives.dart @@ -4,8 +4,6 @@ part of ui; -// ignore_for_file: avoid_classes_with_only_static_members - /// Helper functions for Dart Plugin Registrants. class DartPluginRegistrant { /// Makes sure the that the Dart Plugin Registrant has been called for this diff --git a/engine/src/flutter/lib/web_ui/lib/platform_dispatcher.dart b/engine/src/flutter/lib/web_ui/lib/platform_dispatcher.dart index c9bbdcbfebb..1bbd53d7426 100644 --- a/engine/src/flutter/lib/web_ui/lib/platform_dispatcher.dart +++ b/engine/src/flutter/lib/web_ui/lib/platform_dispatcher.dart @@ -16,7 +16,6 @@ typedef PlatformMessageCallback = void Function(String name, ByteData? data, PlatformMessageResponseCallback? callback); typedef ErrorCallback = bool Function(Object exception, StackTrace stackTrace); -// ignore: avoid_classes_with_only_static_members /// A token that represents a root isolate. class RootIsolateToken { static RootIsolateToken? get instance { diff --git a/engine/src/flutter/lib/web_ui/lib/src/engine/canvaskit/canvaskit_api.dart b/engine/src/flutter/lib/web_ui/lib/src/engine/canvaskit/canvaskit_api.dart index aea839b71b2..a1c69c28167 100644 --- a/engine/src/flutter/lib/web_ui/lib/src/engine/canvaskit/canvaskit_api.dart +++ b/engine/src/flutter/lib/web_ui/lib/src/engine/canvaskit/canvaskit_api.dart @@ -2756,30 +2756,16 @@ extension SkTextStylePropertiesExtension on SkTextStyleProperties { @JS('shadows') external set _shadows(JSArray? value); - set shadows(List? value) => - // TODO(joshualitt): remove this cast when we reify JS types on JS - // backends. - // ignore: unnecessary_cast - _shadows = - (value as List?)?.toJS; + set shadows(List? value) => _shadows = (value as List?)?.toJS; @JS('fontFeatures') external set _fontFeatures(JSArray? value); - set fontFeatures(List? value) => - // TODO(joshualitt): remove this cast when we reify JS types on JS - // backends. - // ignore: unnecessary_cast - _fontFeatures = - (value as List?)?.toJS; + set fontFeatures(List? value) => _fontFeatures = (value as List?)?.toJS; @JS('fontVariations') external set _fontVariations(JSArray? value); set fontVariations(List? value) => - // TODO(joshualitt): remove this cast when we reify JS types on JS - // backends. - // ignore: unnecessary_cast - _fontVariations = - (value as List?)?.toJS; + _fontVariations = (value as List?)?.toJS; } @JS() diff --git a/engine/src/flutter/lib/web_ui/lib/src/engine/dom.dart b/engine/src/flutter/lib/web_ui/lib/src/engine/dom.dart index 689408af69d..a65a5a8185d 100644 --- a/engine/src/flutter/lib/web_ui/lib/src/engine/dom.dart +++ b/engine/src/flutter/lib/web_ui/lib/src/engine/dom.dart @@ -158,7 +158,6 @@ extension DomWindowExtension on DomWindow { message.toJSAnyShallow, targetOrigin.toJS, // Cast is necessary so we can call `.toJS` on the right extension. - // ignore: unnecessary_cast (messagePorts as List).toJS, ); } diff --git a/engine/src/flutter/lib/web_ui/lib/src/engine/html/renderer.dart b/engine/src/flutter/lib/web_ui/lib/src/engine/html/renderer.dart index 8a77dee38f7..d2310db29cf 100644 --- a/engine/src/flutter/lib/web_ui/lib/src/engine/html/renderer.dart +++ b/engine/src/flutter/lib/web_ui/lib/src/engine/html/renderer.dart @@ -140,8 +140,7 @@ class HtmlRenderer implements Renderer { required ui.ImageFilter outer, required ui.ImageFilter inner, }) { - // TODO(ferhat): add implementation and remove the "ignore". - // ignore: avoid_unused_constructor_parameters + // TODO(ferhat): add implementation. throw UnimplementedError('ImageFilter.erode not implemented for HTML renderer.'); } diff --git a/engine/src/flutter/lib/web_ui/lib/src/engine/safe_browser_api.dart b/engine/src/flutter/lib/web_ui/lib/src/engine/safe_browser_api.dart index c2b586f3e78..87a51d03f72 100644 --- a/engine/src/flutter/lib/web_ui/lib/src/engine/safe_browser_api.dart +++ b/engine/src/flutter/lib/web_ui/lib/src/engine/safe_browser_api.dart @@ -869,7 +869,6 @@ class GlContext { } } -// ignore: avoid_classes_with_only_static_members /// Creates gl context from cached OffscreenCanvas for webgl rendering to image. class GlContextCache { static int _maxPixelWidth = 0; diff --git a/engine/src/flutter/lib/web_ui/lib/src/engine/skwasm/skwasm_impl.dart b/engine/src/flutter/lib/web_ui/lib/src/engine/skwasm/skwasm_impl.dart index fd370c7a0fb..0485667c369 100644 --- a/engine/src/flutter/lib/web_ui/lib/src/engine/skwasm/skwasm_impl.dart +++ b/engine/src/flutter/lib/web_ui/lib/src/engine/skwasm/skwasm_impl.dart @@ -4,7 +4,6 @@ @DefaultAsset('skwasm') // The web_sdk/sdk_rewriter.dart uses this directive. -// ignore: unnecessary_library_directive library skwasm_impl; import 'dart:ffi'; diff --git a/engine/src/flutter/lib/web_ui/lib/src/engine/skwasm/skwasm_impl/vertices.dart b/engine/src/flutter/lib/web_ui/lib/src/engine/skwasm/skwasm_impl/vertices.dart index 80bf64eea1d..1a7c85abfdc 100644 --- a/engine/src/flutter/lib/web_ui/lib/src/engine/skwasm/skwasm_impl/vertices.dart +++ b/engine/src/flutter/lib/web_ui/lib/src/engine/skwasm/skwasm_impl/vertices.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// ignore_for_file: avoid_unused_constructor_parameters - import 'dart:ffi'; import 'dart:typed_data'; diff --git a/engine/src/flutter/lib/web_ui/lib/src/engine/view_embedder/dimensions_provider/custom_element_dimensions_provider.dart b/engine/src/flutter/lib/web_ui/lib/src/engine/view_embedder/dimensions_provider/custom_element_dimensions_provider.dart index 580418cc75b..97583996421 100644 --- a/engine/src/flutter/lib/web_ui/lib/src/engine/view_embedder/dimensions_provider/custom_element_dimensions_provider.dart +++ b/engine/src/flutter/lib/web_ui/lib/src/engine/view_embedder/dimensions_provider/custom_element_dimensions_provider.dart @@ -74,9 +74,7 @@ class CustomElementDimensionsProvider extends DimensionsProvider { void close() { super.close(); _hostElementResizeObserver?.disconnect(); - // ignore:unawaited_futures _dprChangeStreamSubscription?.cancel(); - // ignore:unawaited_futures _onResizeStreamController.close(); } diff --git a/engine/src/flutter/lib/web_ui/lib/src/engine/view_embedder/dimensions_provider/full_page_dimensions_provider.dart b/engine/src/flutter/lib/web_ui/lib/src/engine/view_embedder/dimensions_provider/full_page_dimensions_provider.dart index 2c65550c695..d7edf4220bb 100644 --- a/engine/src/flutter/lib/web_ui/lib/src/engine/view_embedder/dimensions_provider/full_page_dimensions_provider.dart +++ b/engine/src/flutter/lib/web_ui/lib/src/engine/view_embedder/dimensions_provider/full_page_dimensions_provider.dart @@ -51,7 +51,6 @@ class FullPageDimensionsProvider extends DimensionsProvider { void close() { super.close(); _domResizeSubscription.cancel(); - // ignore:unawaited_futures _onResizeStreamController.close(); } diff --git a/engine/src/flutter/lib/web_ui/test/common/matchers.dart b/engine/src/flutter/lib/web_ui/test/common/matchers.dart index cfae19b378e..dba502fe6e0 100644 --- a/engine/src/flutter/lib/web_ui/test/common/matchers.dart +++ b/engine/src/flutter/lib/web_ui/test/common/matchers.dart @@ -110,7 +110,7 @@ double _rectDistance(Rect a, Rect b) { } double _sizeDistance(Size a, Size b) { - final Offset delta = (b - a) as Offset; // ignore: unnecessary_parenthesis + final Offset delta = (b - a) as Offset; return delta.distance; } diff --git a/engine/src/flutter/lib/web_ui/test/engine/channel_buffers_test.dart b/engine/src/flutter/lib/web_ui/test/engine/channel_buffers_test.dart index 2ce18922987..5057e56a336 100644 --- a/engine/src/flutter/lib/web_ui/test/engine/channel_buffers_test.dart +++ b/engine/src/flutter/lib/web_ui/test/engine/channel_buffers_test.dart @@ -191,7 +191,7 @@ void testMain() { } void twoCallback(ByteData? responseData) { - throw TestFailure('wrong callback called'); // ignore: only_throw_errors + throw TestFailure('wrong callback called'); } _resize(buffers, channel, 100); @@ -214,7 +214,7 @@ void testMain() { } void twoCallback(ByteData? responseData) { - throw TestFailure('wrong callback called'); // ignore: only_throw_errors + throw TestFailure('wrong callback called'); } _resize(buffers, channel, 1); diff --git a/engine/src/flutter/lib/web_ui/test/ui/canvas_test.dart b/engine/src/flutter/lib/web_ui/test/ui/canvas_test.dart index b4434ae8cd7..587ce3c7fbe 100644 --- a/engine/src/flutter/lib/web_ui/test/ui/canvas_test.dart +++ b/engine/src/flutter/lib/web_ui/test/ui/canvas_test.dart @@ -46,7 +46,7 @@ Future testMain() async { } on TestFailure { return; } - throw TestFailure('transforms were too close to equal'); // ignore: only_throw_errors + throw TestFailure('transforms were too close to equal'); } test('ui.Canvas.translate affects canvas.getTransform', () { @@ -136,7 +136,7 @@ Future testMain() async { } on TestFailure { return; } - throw TestFailure('transforms were too close to equal'); // ignore: only_throw_errors + throw TestFailure('transforms were too close to equal'); } group('ui.Canvas clip tests', () { diff --git a/engine/src/flutter/testing/dart/image_filter_test.dart b/engine/src/flutter/testing/dart/image_filter_test.dart index a73e53b8c31..bea2755d37b 100644 --- a/engine/src/flutter/testing/dart/image_filter_test.dart +++ b/engine/src/flutter/testing/dart/image_filter_test.dart @@ -159,7 +159,6 @@ void main() async { List colorFilters() { // Create new color filter instances on each invocation. - // ignore: prefer_const_constructors return [ ColorFilter.mode(green, BlendMode.color), // ignore: prefer_const_constructors ColorFilter.mode(red, BlendMode.color), // ignore: prefer_const_constructors diff --git a/engine/src/flutter/testing/dart/spawn_test.dart b/engine/src/flutter/testing/dart/spawn_test.dart index d5ccc669cff..3750520edd5 100644 --- a/engine/src/flutter/testing/dart/spawn_test.dart +++ b/engine/src/flutter/testing/dart/spawn_test.dart @@ -75,5 +75,5 @@ void main() { final Pointer fakePath = 'fake-path'.toNativeUtf8(); expect(_loadLibraryFromKernel(fakePath), null); malloc.free(fakePath); - }, skip: kProfileMode || kReleaseMode); // ignore: avoid_redundant_argument_values + }, skip: kProfileMode || kReleaseMode); } diff --git a/engine/src/flutter/tools/const_finder/test/fixtures/lib/consts.dart b/engine/src/flutter/tools/const_finder/test/fixtures/lib/consts.dart index 2e4ecd52c6a..e4f5f54ea11 100644 --- a/engine/src/flutter/tools/const_finder/test/fixtures/lib/consts.dart +++ b/engine/src/flutter/tools/const_finder/test/fixtures/lib/consts.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// ignore_for_file: prefer_const_constructors, unused_local_variable, depend_on_referenced_packages +// ignore_for_file: prefer_const_constructors, unused_local_variable import 'dart:core'; import 'package:const_finder_fixtures_package/package.dart'; diff --git a/engine/src/flutter/tools/const_finder/test/fixtures/lib/consts_and_non.dart b/engine/src/flutter/tools/const_finder/test/fixtures/lib/consts_and_non.dart index c0f17c7445f..0da1b6dc1a5 100644 --- a/engine/src/flutter/tools/const_finder/test/fixtures/lib/consts_and_non.dart +++ b/engine/src/flutter/tools/const_finder/test/fixtures/lib/consts_and_non.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// ignore_for_file: prefer_const_constructors, unused_local_variable, depend_on_referenced_packages +// ignore_for_file: prefer_const_constructors, unused_local_variable import 'dart:core'; import 'package:const_finder_fixtures_package/package.dart'; diff --git a/engine/src/flutter/tools/const_finder/test/fixtures/pkg/package.dart b/engine/src/flutter/tools/const_finder/test/fixtures/pkg/package.dart index b5256d53e15..87a92bb5722 100644 --- a/engine/src/flutter/tools/const_finder/test/fixtures/pkg/package.dart +++ b/engine/src/flutter/tools/const_finder/test/fixtures/pkg/package.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// ignore_for_file: prefer_const_constructors, depend_on_referenced_packages +// ignore_for_file: prefer_const_constructors import 'package:const_finder_fixtures/target.dart'; void createTargetInPackage() { diff --git a/engine/src/flutter/tools/gen_locale.dart b/engine/src/flutter/tools/gen_locale.dart index ad88be6e9b1..7db64d4cfbc 100644 --- a/engine/src/flutter/tools/gen_locale.dart +++ b/engine/src/flutter/tools/gen_locale.dart @@ -11,8 +11,6 @@ // this script (the first set for _canonicalizeLanguageCode and the second set // for _canonicalizeRegionCode). -// ignore_for_file: avoid_print - import 'dart:async'; import 'dart:convert'; import 'dart:io'; diff --git a/packages/flutter/lib/src/cupertino/colors.dart b/packages/flutter/lib/src/cupertino/colors.dart index 3706a03dc32..f387829b7b1 100644 --- a/packages/flutter/lib/src/cupertino/colors.dart +++ b/packages/flutter/lib/src/cupertino/colors.dart @@ -1163,8 +1163,6 @@ class CupertinoDynamicColor with Diagnosticable implements Color { int get value => _effectiveColor.value; @override - // TODO(matanl): Remove once https://github.com/flutter/engine/pull/56329 lands in the framework. - // ignore: override_on_non_overriding_member, public_member_api_docs int toARGB32() => value; @override diff --git a/packages/flutter/lib/src/painting/notched_shapes.dart b/packages/flutter/lib/src/painting/notched_shapes.dart index d26a4282d34..6768e53919d 100644 --- a/packages/flutter/lib/src/painting/notched_shapes.dart +++ b/packages/flutter/lib/src/painting/notched_shapes.dart @@ -171,10 +171,6 @@ class AutomaticNotchedShape extends NotchedShape { @override Path getOuterPath(Rect hostRect, Rect? guestRect) { - // ignore: avoid_renaming_method_parameters - // The parameters of this method are renamed over the baseclass because they - // would clash with properties of this object, and the use of all four of - // them in the code below is really confusing if they have the same names. final Path hostPath = host.getOuterPath(hostRect); if (guest != null && guestRect != null) { final Path guestPath = guest!.getOuterPath(guestRect); diff --git a/packages/flutter/lib/src/widgets/framework.dart b/packages/flutter/lib/src/widgets/framework.dart index fbf6c6e3aa3..7b1af3d45c3 100644 --- a/packages/flutter/lib/src/widgets/framework.dart +++ b/packages/flutter/lib/src/widgets/framework.dart @@ -34,9 +34,9 @@ export 'package:flutter/foundation.dart' visibleForTesting; export 'package:flutter/foundation.dart' show ErrorDescription, ErrorHint, ErrorSummary, FlutterError, debugPrint, debugPrintStack; -export 'package:flutter/foundation.dart' show ValueChanged, ValueGetter, ValueSetter, VoidCallback; export 'package:flutter/foundation.dart' show DiagnosticLevel, DiagnosticsNode; export 'package:flutter/foundation.dart' show Key, LocalKey, ValueKey; +export 'package:flutter/foundation.dart' show ValueChanged, ValueGetter, ValueSetter, VoidCallback; export 'package:flutter/rendering.dart' show RenderBox, RenderObject, debugDumpLayerTree, debugDumpRenderTree; @@ -6947,7 +6947,6 @@ mixin RootElementMixin on Element { /// to [runApp]. The binding is responsible for driving the build pipeline by /// calling the build owner's [BuildOwner.buildScope] method. See /// [WidgetsBinding.drawFrame]. - // ignore: use_setters_to_change_properties, (API predates enforcing the lint) void assignOwner(BuildOwner owner) { _owner = owner; _parentBuildScope = BuildScope(); diff --git a/packages/flutter/lib/src/widgets/widget_inspector.dart b/packages/flutter/lib/src/widgets/widget_inspector.dart index 616be4a298a..d4fd4c2eb23 100644 --- a/packages/flutter/lib/src/widgets/widget_inspector.dart +++ b/packages/flutter/lib/src/widgets/widget_inspector.dart @@ -3748,10 +3748,7 @@ class _Location { required this.file, required this.line, required this.column, - // TODO(srawlins): `unused_element_parameter` is being separated from - // `unused_element`. Ignore both names until the separation is complete. - // ignore: unused_element, unused_element_parameter - this.name, + this.name, // ignore: unused_element_parameter }); /// File path of the location. diff --git a/packages/flutter/test/material/debug_test.dart b/packages/flutter/test/material/debug_test.dart index f23821fbbc4..9e12f197a49 100644 --- a/packages/flutter/test/material/debug_test.dart +++ b/packages/flutter/test/material/debug_test.dart @@ -188,7 +188,6 @@ void main() { FlutterError.onError = oldHandler; expect(exceptions.length, 1); - // ignore: avoid_dynamic_calls expect(exceptions.single.runtimeType, FlutterError); final FlutterError error = exceptions.first as FlutterError; expect(error.diagnostics.length, 5); diff --git a/packages/flutter/test/material/scaffold_test.dart b/packages/flutter/test/material/scaffold_test.dart index 7f8125bffb1..8259f95d187 100644 --- a/packages/flutter/test/material/scaffold_test.dart +++ b/packages/flutter/test/material/scaffold_test.dart @@ -2475,7 +2475,6 @@ void main() { FlutterError.onError = oldHandler; expect(exceptions.length, 1); - // ignore: avoid_dynamic_calls expect(exceptions.single.runtimeType, FlutterError); final FlutterError error = exceptions.first as FlutterError; expect(error.diagnostics.length, 5); diff --git a/packages/flutter/test/material/time_picker_test.dart b/packages/flutter/test/material/time_picker_test.dart index bf694a89367..c55e2a306b5 100644 --- a/packages/flutter/test/material/time_picker_test.dart +++ b/packages/flutter/test/material/time_picker_test.dart @@ -645,10 +645,7 @@ void main() { RenderObject render = tester.renderObject( find.byWidgetPredicate((Widget w) => '${w.runtimeType}' == '_DayPeriodInputPadding'), ); - expect( - (render as dynamic).orientation, - Orientation.portrait, - ); // ignore: avoid_dynamic_calls + expect((render as dynamic).orientation, Orientation.portrait); // landscape tester.view.physicalSize = const Size(800.5, 800); diff --git a/packages/flutter_test/lib/src/window.dart b/packages/flutter_test/lib/src/window.dart index 9c7b74b3577..b698a8af5a0 100644 --- a/packages/flutter_test/lib/src/window.dart +++ b/packages/flutter_test/lib/src/window.dart @@ -391,7 +391,6 @@ class TestPlatformDispatcher implements PlatformDispatcher { bool get supportsShowingSystemContextMenu => _supportsShowingSystemContextMenu ?? _platformDispatcher.supportsShowingSystemContextMenu; bool? _supportsShowingSystemContextMenu; - // ignore: avoid_setters_without_getters set supportsShowingSystemContextMenu(bool value) { _supportsShowingSystemContextMenu = value; } diff --git a/packages/flutter_test/test/widget_tester_test.dart b/packages/flutter_test/test/widget_tester_test.dart index a05e8abdac9..206d416d816 100644 --- a/packages/flutter_test/test/widget_tester_test.dart +++ b/packages/flutter_test/test/widget_tester_test.dart @@ -14,7 +14,7 @@ import 'package:flutter/scheduler.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:matcher/expect.dart' as matcher; -import 'package:matcher/src/expect/async_matcher.dart'; // ignore: implementation_imports +import 'package:matcher/src/expect/async_matcher.dart'; import 'multi_view_testing.dart'; diff --git a/packages/flutter_tools/lib/src/base/error_handling_io.dart b/packages/flutter_tools/lib/src/base/error_handling_io.dart index 416b46d1d8f..701ee191d59 100644 --- a/packages/flutter_tools/lib/src/base/error_handling_io.dart +++ b/packages/flutter_tools/lib/src/base/error_handling_io.dart @@ -326,7 +326,6 @@ class ErrorHandlingFile extends ForwardingFileSystemEntity with F bytes += chunkLength; } } catch (err) { - // ignore: avoid_catches_without_on_clauses, rethrows ErrorHandlingFileSystem.deleteIfExists(resultFile, recursive: true); rethrow; } finally { diff --git a/packages/flutter_tools/lib/src/base/process.dart b/packages/flutter_tools/lib/src/base/process.dart index 32e18de0179..f04f6241255 100644 --- a/packages/flutter_tools/lib/src/base/process.dart +++ b/packages/flutter_tools/lib/src/base/process.dart @@ -667,7 +667,6 @@ Future exitWithHooks(int code, {required ShutdownHooks shutdownHooks}) asyn // This catches all exceptions because the error is propagated on the // completer. } catch (error, stackTrace) { - // ignore: avoid_catches_without_on_clauses completer.completeError(error, stackTrace); } }); diff --git a/packages/flutter_tools/lib/src/base/task_queue.dart b/packages/flutter_tools/lib/src/base/task_queue.dart index 19e5d50e984..9c9b63d2a8a 100644 --- a/packages/flutter_tools/lib/src/base/task_queue.dart +++ b/packages/flutter_tools/lib/src/base/task_queue.dart @@ -89,7 +89,6 @@ class _TaskQueueItem { try { _completer.complete(await _closure()); } catch (e) { - // ignore: avoid_catches_without_on_clauses, forwards to Future _completer.completeError(e); } finally { onComplete?.call(); diff --git a/packages/flutter_tools/lib/src/build_system/targets/ios.dart b/packages/flutter_tools/lib/src/build_system/targets/ios.dart index 2c50c417484..2a4445d8bb5 100644 --- a/packages/flutter_tools/lib/src/build_system/targets/ios.dart +++ b/packages/flutter_tools/lib/src/build_system/targets/ios.dart @@ -629,7 +629,6 @@ class ReleaseIosApplicationBundle extends _IosAssetBundleWithDSYM { try { await super.build(environment); } catch (_) { - // ignore: avoid_catches_without_on_clauses buildSuccess = false; rethrow; } finally { diff --git a/packages/flutter_tools/lib/src/build_system/targets/macos.dart b/packages/flutter_tools/lib/src/build_system/targets/macos.dart index 9ebe371a988..cea8f136307 100644 --- a/packages/flutter_tools/lib/src/build_system/targets/macos.dart +++ b/packages/flutter_tools/lib/src/build_system/targets/macos.dart @@ -706,7 +706,6 @@ class ReleaseMacOSBundleFlutterAssets extends MacOSBundleFlutterAssets { try { await super.build(environment); } catch (_) { - // ignore: avoid_catches_without_on_clauses buildSuccess = false; rethrow; } finally { diff --git a/packages/flutter_tools/lib/src/commands/packages.dart b/packages/flutter_tools/lib/src/commands/packages.dart index 2a98d49e74c..9871822a9b1 100644 --- a/packages/flutter_tools/lib/src/commands/packages.dart +++ b/packages/flutter_tools/lib/src/commands/packages.dart @@ -357,7 +357,6 @@ class PackagesGetCommand extends FlutterCommand { ); // Not limiting to catching Exception because the exception is rethrown. } catch (_) { - // ignore: avoid_catches_without_on_clauses final Duration elapsedDuration = timer.elapsed; analytics.send( Event.timing( diff --git a/packages/flutter_tools/lib/src/commands/update_packages.dart b/packages/flutter_tools/lib/src/commands/update_packages.dart index e903d7a64ff..a1e9cb7c227 100644 --- a/packages/flutter_tools/lib/src/commands/update_packages.dart +++ b/packages/flutter_tools/lib/src/commands/update_packages.dart @@ -629,7 +629,6 @@ class UpdatePackagesCommand extends FlutterCommand { status.stop(); // The exception is rethrown, so don't catch only Exceptions. } catch (exception) { - // ignore: avoid_catches_without_on_clauses status.cancel(); rethrow; } diff --git a/packages/flutter_tools/lib/src/flutter_manifest.dart b/packages/flutter_tools/lib/src/flutter_manifest.dart index ae655e768e6..6be67537816 100644 --- a/packages/flutter_tools/lib/src/flutter_manifest.dart +++ b/packages/flutter_tools/lib/src/flutter_manifest.dart @@ -664,7 +664,6 @@ void _validateFlutter(YamlMap? yaml, List errors) { for (int i = 0; i < yamlList.length; i++) { if (yamlList[i] is! T) { - // ignore: avoid_dynamic_calls errors.add( 'Expected $context to be a list of $typeAlias, but element at index $i was a ${yamlList[i].runtimeType}.', ); @@ -682,7 +681,6 @@ void _validateDeferredComponents(MapEntry kvp, List er for (int i = 0; i < yamlList.length; i++) { final Object? valueMap = yamlList[i]; if (valueMap is! YamlMap) { - // ignore: avoid_dynamic_calls errors.add( 'Expected the $i element in "${kvp.key}" to be a map, but got ${yamlList[i]} (${yamlList[i].runtimeType}).', ); diff --git a/packages/flutter_tools/lib/src/resident_runner.dart b/packages/flutter_tools/lib/src/resident_runner.dart index 08f68a30912..4c00216844e 100644 --- a/packages/flutter_tools/lib/src/resident_runner.dart +++ b/packages/flutter_tools/lib/src/resident_runner.dart @@ -1799,7 +1799,6 @@ class TerminalHandler { await _commonTerminalInputHandler(command); // Catch all exception since this is doing cleanup and rethrowing. } catch (error, st) { - // ignore: avoid_catches_without_on_clauses // Don't print stack traces for known error types. if (error is! ToolExit) { _logger.printError('$error\n$st'); diff --git a/packages/flutter_tools/lib/src/run_hot.dart b/packages/flutter_tools/lib/src/run_hot.dart index 1ba9d5cb940..4926cdca0d6 100644 --- a/packages/flutter_tools/lib/src/run_hot.dart +++ b/packages/flutter_tools/lib/src/run_hot.dart @@ -258,7 +258,6 @@ class HotRunner extends ResidentRunner { ); // Catches all exceptions, non-Exception objects are rethrown. } catch (error) { - // ignore: avoid_catches_without_on_clauses if (error is! Exception && error is! String) { rethrow; } diff --git a/packages/flutter_tools/lib/src/test/flutter_web_platform.dart b/packages/flutter_tools/lib/src/test/flutter_web_platform.dart index 57c50b6cc73..80b27fb7a61 100644 --- a/packages/flutter_tools/lib/src/test/flutter_web_platform.dart +++ b/packages/flutter_tools/lib/src/test/flutter_web_platform.dart @@ -991,7 +991,6 @@ class BrowserManager { return await controller.suite; // Not limiting to catching Exception because the exception is rethrown. } catch (_) { - // ignore: avoid_catches_without_on_clauses closeIframe(); rethrow; } diff --git a/packages/flutter_tools/lib/src/tracing.dart b/packages/flutter_tools/lib/src/tracing.dart index 62e720628c0..626c7a5cc7d 100644 --- a/packages/flutter_tools/lib/src/tracing.dart +++ b/packages/flutter_tools/lib/src/tracing.dart @@ -98,7 +98,6 @@ class Tracing { } // The exception is rethrown, so don't catch only Exceptions. } catch (exception) { - // ignore: avoid_catches_without_on_clauses status.cancel(); rethrow; } diff --git a/packages/flutter_tools/test/commands.shard/hermetic/run_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/run_test.dart index 65486526616..7fe5d264e69 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/run_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/run_test.dart @@ -1237,7 +1237,6 @@ void main() { try { await createTestCommandRunner(command).run(['run', '--no-pub']); } catch (err) { - // ignore: avoid_catches_without_on_clauses fail('Expected no error, got $err'); } expect(fakeTerminal.setSingleCharModeHistory, isEmpty); diff --git a/packages/flutter_tools/test/general.shard/ios/xcode_debug_test.dart b/packages/flutter_tools/test/general.shard/ios/xcode_debug_test.dart index 1cedb4efe7c..1e35fd34a46 100644 --- a/packages/flutter_tools/test/general.shard/ios/xcode_debug_test.dart +++ b/packages/flutter_tools/test/general.shard/ios/xcode_debug_test.dart @@ -1168,7 +1168,6 @@ void main() { expect(schemeFile.existsSync(), isTrue); expect(schemeFile.readAsStringSync(), contains('FilePath = "/path/to/bundle"')); } catch (err) { - // ignore: avoid_catches_without_on_clauses fail(err.toString()); } finally { projectDirectory.deleteSync(recursive: true); diff --git a/packages/flutter_tools/test/general.shard/windows_version_validator_test.dart b/packages/flutter_tools/test/general.shard/windows_version_validator_test.dart index c77429938e1..64a34fd908c 100644 --- a/packages/flutter_tools/test/general.shard/windows_version_validator_test.dart +++ b/packages/flutter_tools/test/general.shard/windows_version_validator_test.dart @@ -291,7 +291,6 @@ OS 版本: 10.0.22621 暂缺 Build 22621 try { final ProcessResult result = await processLister.getProcessesWithPath(); expect(result.stdout, ProcessLister.powershell); - // ignore: avoid_catches_without_on_clauses } catch (e) { fail('Unexpected exception: $e'); } @@ -312,7 +311,6 @@ OS 版本: 10.0.22621 暂缺 Build 22621 try { final ProcessResult result = await processLister.getProcessesWithPath(); expect(result.stdout, ProcessLister.pwsh); - // ignore: avoid_catches_without_on_clauses } catch (e) { fail('Unexpected exception: $e'); } @@ -332,7 +330,6 @@ OS 版本: 10.0.22621 暂缺 Build 22621 fail('Should have thrown, but successfully ran ${result.stdout}'); } on StateError { // Expected - // ignore: avoid_catches_without_on_clauses } catch (e) { fail('Unexpected exception: $e'); } diff --git a/packages/flutter_tools/test/src/common.dart b/packages/flutter_tools/test/src/common.dart index ff71902bc76..ae3748a5fb1 100644 --- a/packages/flutter_tools/test/src/common.dart +++ b/packages/flutter_tools/test/src/common.dart @@ -150,7 +150,6 @@ Future expectToolExitLater(Future future, Matcher messageMatcher) expect(e.message, messageMatcher); // Catch all exceptions to give a better test failure message. } catch (e, trace) { - // ignore: avoid_catches_without_on_clauses fail('ToolExit expected, got $e\n$trace'); } } @@ -160,7 +159,6 @@ Future expectReturnsNormallyLater(Future future) async { await future; // Catch all exceptions to give a better test failure message. } catch (e, trace) { - // ignore: avoid_catches_without_on_clauses fail('Expected to run with no exceptions, got $e\n$trace'); } } diff --git a/packages/flutter_tools/test/src/fakes.dart b/packages/flutter_tools/test/src/fakes.dart index a16eed54e58..8af27529f38 100644 --- a/packages/flutter_tools/test/src/fakes.dart +++ b/packages/flutter_tools/test/src/fakes.dart @@ -127,7 +127,6 @@ class MemoryIOSink implements IOSink { add(data); // Catches all exceptions to propagate them to the completer. } catch (err, stack) { - // ignore: avoid_catches_without_on_clauses sub.cancel(); completer.completeError(err, stack); } @@ -201,10 +200,8 @@ class MemoryStdout extends MemoryIOSink implements io.Stdout { bool _hasTerminal = true; @override - // ignore: override_on_non_overriding_member String get lineTerminator => '\n'; @override - // ignore: override_on_non_overriding_member set lineTerminator(String value) { throw UnimplementedError('Setting the line terminator is not supported'); }