From ed0c8d77f8b5fbfdc90c6515022bd2df1b3fd2cb Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Wed, 3 Aug 2022 15:42:06 -0700 Subject: [PATCH] Remove some outdated ignores from framework (#108915) --- packages/flutter/lib/src/foundation/assertions.dart | 2 +- packages/flutter/lib/src/gestures/long_press.dart | 2 -- packages/flutter/lib/src/widgets/framework.dart | 2 +- packages/flutter/lib/src/widgets/implicit_animations.dart | 2 +- packages/flutter/lib/src/widgets/unique_widget.dart | 2 +- packages/flutter/lib/src/widgets/widget_inspector.dart | 2 +- .../foundation/_compute_caller_unsound_null_safety_error.dart | 2 +- packages/flutter/test/foundation/assertions_test.dart | 3 +-- packages/flutter/test/material/scrollbar_test.dart | 2 -- packages/flutter/test/painting/painting_utils.dart | 2 +- .../test/rendering/sliver_fixed_extent_layout_test.dart | 1 - packages/flutter/test/services/hardware_keyboard_test.dart | 1 - packages/flutter/test/widgets/framework_test.dart | 2 +- packages/flutter/test/widgets/raw_keyboard_listener_test.dart | 2 +- 14 files changed, 10 insertions(+), 17 deletions(-) diff --git a/packages/flutter/lib/src/foundation/assertions.dart b/packages/flutter/lib/src/foundation/assertions.dart index 223d8070436..a2bdae4e2cd 100644 --- a/packages/flutter/lib/src/foundation/assertions.dart +++ b/packages/flutter/lib/src/foundation/assertions.dart @@ -670,7 +670,7 @@ class FlutterErrorDetails with Diagnosticable { super.debugFillProperties(properties); final DiagnosticsNode verb = ErrorDescription('thrown${ context != null ? ErrorDescription(" $context") : ""}'); final Diagnosticable? diagnosticable = _exceptionToDiagnosticable(); - if (exception is NullThrownError) { // ignore: deprecated_member_use + if (exception is NullThrownError) { properties.add(ErrorDescription('The null value was $verb.')); } else if (exception is num) { properties.add(ErrorDescription('The number $exception was $verb.')); diff --git a/packages/flutter/lib/src/gestures/long_press.dart b/packages/flutter/lib/src/gestures/long_press.dart index 73b9ff78a07..414c2dcebba 100644 --- a/packages/flutter/lib/src/gestures/long_press.dart +++ b/packages/flutter/lib/src/gestures/long_press.dart @@ -250,8 +250,6 @@ class LongPressGestureRecognizer extends PrimaryPointerGestureRecognizer { /// {@macro flutter.gestures.GestureRecognizer.supportedDevices} LongPressGestureRecognizer({ Duration? duration, - // TODO(goderbauer): remove ignore when https://github.com/dart-lang/linter/issues/3349 is fixed. - // ignore: avoid_init_to_null super.postAcceptSlopTolerance = null, @Deprecated( 'Migrate to supportedDevices. ' diff --git a/packages/flutter/lib/src/widgets/framework.dart b/packages/flutter/lib/src/widgets/framework.dart index 55b40aad44f..041de2631fd 100644 --- a/packages/flutter/lib/src/widgets/framework.dart +++ b/packages/flutter/lib/src/widgets/framework.dart @@ -781,7 +781,7 @@ abstract class StatefulWidget extends Widget { /// [State] objects. @protected @factory - State createState(); // ignore: no_logic_in_create_state, this is the original sin + State createState(); } /// Tracks the lifecycle of [State] objects when asserts are enabled. diff --git a/packages/flutter/lib/src/widgets/implicit_animations.dart b/packages/flutter/lib/src/widgets/implicit_animations.dart index 522ca0590e5..0c13604fe0f 100644 --- a/packages/flutter/lib/src/widgets/implicit_animations.dart +++ b/packages/flutter/lib/src/widgets/implicit_animations.dart @@ -297,7 +297,7 @@ abstract class ImplicitlyAnimatedWidget extends StatefulWidget { final VoidCallback? onEnd; @override - ImplicitlyAnimatedWidgetState createState(); // ignore: no_logic_in_create_state, https://github.com/dart-lang/linter/issues/2345 + ImplicitlyAnimatedWidgetState createState(); @override void debugFillProperties(DiagnosticPropertiesBuilder properties) { diff --git a/packages/flutter/lib/src/widgets/unique_widget.dart b/packages/flutter/lib/src/widgets/unique_widget.dart index 30a5e6403d1..ee90cb50bf7 100644 --- a/packages/flutter/lib/src/widgets/unique_widget.dart +++ b/packages/flutter/lib/src/widgets/unique_widget.dart @@ -28,7 +28,7 @@ abstract class UniqueWidget> extends StatefulWid super(key: key); @override - T createState(); // ignore: no_logic_in_create_state, https://github.com/dart-lang/linter/issues/2345 + T createState(); /// The state for the unique inflated instance of this widget. /// diff --git a/packages/flutter/lib/src/widgets/widget_inspector.dart b/packages/flutter/lib/src/widgets/widget_inspector.dart index 6d2582309cd..55d3dbbc303 100644 --- a/packages/flutter/lib/src/widgets/widget_inspector.dart +++ b/packages/flutter/lib/src/widgets/widget_inspector.dart @@ -978,7 +978,7 @@ mixin WidgetInspectorService { bool enabled = false; assert(() { // TODO(kenz): add support for structured errors on the web. - enabled = const bool.fromEnvironment('flutter.inspector.structuredErrors', defaultValue: !kIsWeb); // ignore: avoid_redundant_argument_values + enabled = const bool.fromEnvironment('flutter.inspector.structuredErrors', defaultValue: !kIsWeb); return true; }()); return enabled; diff --git a/packages/flutter/test/foundation/_compute_caller_unsound_null_safety_error.dart b/packages/flutter/test/foundation/_compute_caller_unsound_null_safety_error.dart index 971670099b7..8ceaddbc977 100644 --- a/packages/flutter/test/foundation/_compute_caller_unsound_null_safety_error.dart +++ b/packages/flutter/test/foundation/_compute_caller_unsound_null_safety_error.dart @@ -16,7 +16,7 @@ void main() async { try { await compute(throwNull, null); } catch (e) { - if (e is! NullThrownError) { // ignore: deprecated_member_use + if (e is! NullThrownError) { throw Exception('compute returned bad result'); } } diff --git a/packages/flutter/test/foundation/assertions_test.dart b/packages/flutter/test/foundation/assertions_test.dart index 7428e38e494..88e1d1da468 100644 --- a/packages/flutter/test/foundation/assertions_test.dart +++ b/packages/flutter/test/foundation/assertions_test.dart @@ -60,7 +60,7 @@ void main() { ); expect( FlutterErrorDetails( - exception: NullThrownError(), // ignore: deprecated_member_use + exception: NullThrownError(), library: 'LIBRARY', context: ErrorDescription('CONTEXTING'), informationCollector: () sync* { @@ -113,7 +113,6 @@ void main() { '═════════════════════════════════════════════════════════════════\n', ); expect( - // ignore: deprecated_member_use FlutterErrorDetails(exception: NullThrownError()).toString(), '══╡ EXCEPTION CAUGHT BY FLUTTER FRAMEWORK ╞══════════════════════\n' 'The null value was thrown.\n' diff --git a/packages/flutter/test/material/scrollbar_test.dart b/packages/flutter/test/material/scrollbar_test.dart index 37a3f32401b..f5cf45a456f 100644 --- a/packages/flutter/test/material/scrollbar_test.dart +++ b/packages/flutter/test/material/scrollbar_test.dart @@ -148,11 +148,9 @@ void main() { viewportDimension: 100.0, axisDirection: AxisDirection.down, ); - // ignore: avoid_dynamic_calls scrollPainter!.update(metrics, AxisDirection.down); final TestCanvas canvas = TestCanvas(); - // ignore: avoid_dynamic_calls scrollPainter.paint(canvas, const Size(10.0, 100.0)); // Scrollbar is not supposed to draw anything if there isn't enough content. diff --git a/packages/flutter/test/painting/painting_utils.dart b/packages/flutter/test/painting/painting_utils.dart index acc9bbd57ad..b7edc0da122 100644 --- a/packages/flutter/test/painting/painting_utils.dart +++ b/packages/flutter/test/painting/painting_utils.dart @@ -20,7 +20,7 @@ class PaintingBindingSpy extends BindingBase with SchedulerBinding, ServicesBind } @override - // ignore: MUST_CALL_SUPER + // ignore: must_call_super void initLicenses() { // Do not include any licenses, because we're a test, and the LICENSE file // doesn't get generated for tests. diff --git a/packages/flutter/test/rendering/sliver_fixed_extent_layout_test.dart b/packages/flutter/test/rendering/sliver_fixed_extent_layout_test.dart index 196b9122757..3e7f9fa65ec 100644 --- a/packages/flutter/test/rendering/sliver_fixed_extent_layout_test.dart +++ b/packages/flutter/test/rendering/sliver_fixed_extent_layout_test.dart @@ -222,7 +222,6 @@ class TestRenderSliverFixedExtentBoxAdaptor extends RenderSliverFixedExtentBoxAd :super(childManager: TestRenderSliverBoxChildManager(children: [])); @override - // ignore: unnecessary_overrides int getMaxChildIndexForScrollOffset(double scrollOffset, double itemExtent) { return super.getMaxChildIndexForScrollOffset(scrollOffset, itemExtent); } diff --git a/packages/flutter/test/services/hardware_keyboard_test.dart b/packages/flutter/test/services/hardware_keyboard_test.dart index b5ef83af97c..529067c1070 100644 --- a/packages/flutter/test/services/hardware_keyboard_test.dart +++ b/packages/flutter/test/services/hardware_keyboard_test.dart @@ -75,7 +75,6 @@ void main() { return false; }); // While ShiftLeft is held (the event of which was skipped), press keyA. - // ignore: prefer_const_declarations final Map rawMessage = kIsWeb ? ( KeyEventSimulator.getKeyData( LogicalKeyboardKey.keyA, diff --git a/packages/flutter/test/widgets/framework_test.dart b/packages/flutter/test/widgets/framework_test.dart index dad56050842..0787033d17e 100644 --- a/packages/flutter/test/widgets/framework_test.dart +++ b/packages/flutter/test/widgets/framework_test.dart @@ -1268,7 +1268,7 @@ void main() { }); testWidgets('scheduleBuild while debugBuildingDirtyElements is true', (WidgetTester tester) async { - /// ignore here is required for testing purpose because changing the flag properly is hard + // ignore here is required for testing purpose because changing the flag properly is hard // ignore: invalid_use_of_protected_member tester.binding.debugBuildingDirtyElements = true; late FlutterError error; diff --git a/packages/flutter/test/widgets/raw_keyboard_listener_test.dart b/packages/flutter/test/widgets/raw_keyboard_listener_test.dart index 3bbfcbc35fd..64f927b5f95 100644 --- a/packages/flutter/test/widgets/raw_keyboard_listener_test.dart +++ b/packages/flutter/test/widgets/raw_keyboard_listener_test.dart @@ -62,7 +62,7 @@ void main() { focusNode.requestFocus(); await tester.idle(); - await tester.sendKeyEvent(LogicalKeyboardKey.metaLeft, platform: 'web'); // ignore: avoid_redundant_argument_values + await tester.sendKeyEvent(LogicalKeyboardKey.metaLeft, platform: 'web'); await tester.idle(); expect(events.length, 2);