Skip to content

Commit c783ce2

Browse files
authored
Remove outdated ignores (flutter#162773)
Powered by the new and amazing `unnecessary_ignore` lint. We're not enabling this lint by default because being able to temporarily use ignores that don't ignore anything is a powerful tool to enable migrations. We should turn this lint on locally periodically, though, and clean up all outdated ignores.
1 parent 5944d99 commit c783ce2

File tree

60 files changed

+39
-147
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+39
-147
lines changed

analysis_options.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ linter:
223223
- unnecessary_constructor_name
224224
# - unnecessary_final # conflicts with prefer_final_locals
225225
- unnecessary_getters_setters
226+
# - unnecessary_ignore # Disabled by default to simplify migrations; should be periodically enabled locally to clean up offenders
226227
# - unnecessary_lambdas # has false positives: https://github.com/dart-lang/linter/issues/498
227228
- unnecessary_late
228229
- unnecessary_library_directive

dev/a11y_assessments/test/home_page_test.dart

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
// ignore_for_file: avoid_dynamic_calls
6-
75
import 'package:a11y_assessments/main.dart';
86
import 'package:a11y_assessments/use_cases/action_chip.dart';
97
import 'package:a11y_assessments/use_cases/auto_complete.dart';

dev/devicelab/bin/tasks/build_android_host_app_with_module_aar.dart

-1
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,6 @@ class ModuleTest {
437437
Future<void> main() async {
438438
await task(
439439
combine(<TaskFunction>[
440-
// ignore: avoid_redundant_argument_values
441440
ModuleTest(gradleVersion: '8.4').call,
442441
ModuleTest(gradleVersion: '8.4-rc-3').call,
443442
]),

dev/devicelab/bin/tasks/build_android_host_app_with_module_source.dart

+1-6
Original file line numberDiff line numberDiff line change
@@ -407,10 +407,5 @@ class ModuleTest {
407407
}
408408

409409
Future<void> main() async {
410-
await task(
411-
combine(<TaskFunction>[
412-
// ignore: avoid_redundant_argument_values
413-
ModuleTest(gradleVersion: '8.7').call,
414-
]),
415-
);
410+
await task(combine(<TaskFunction>[ModuleTest(gradleVersion: '8.7').call]));
416411
}

dev/integration_tests/display_cutout_rotation/test_driver/display_cutout_test_test.dart

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
// ignore_for_file: avoid_print
6-
75
import 'dart:async';
86
import 'dart:convert';
97
import 'dart:io';

dev/integration_tests/link_hook/lib/link_hook_bindings_generated.dart

-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
// ignore_for_file: always_specify_types
6-
// ignore_for_file: camel_case_types
7-
// ignore_for_file: non_constant_identifier_names
8-
95
// AUTO GENERATED FILE, DO NOT EDIT.
106
//
117
// Generated by `package:ffigen`.

dev/integration_tests/new_gallery/lib/data/demos.dart

+3-10
Original file line numberDiff line numberDiff line change
@@ -1036,11 +1036,7 @@ class Demos {
10361036
description: localizations.demoCupertinoPickerDescription,
10371037
documentationUrl: '$_docsBaseUrl/cupertino/CupertinoDatePicker-class.html',
10381038
buildRoute:
1039-
(_) => DeferredWidget(
1040-
cupertinoLoader,
1041-
// ignore: prefer_const_constructors
1042-
() => cupertino_demos.CupertinoPickerDemo(),
1043-
),
1039+
(_) => DeferredWidget(cupertinoLoader, () => cupertino_demos.CupertinoPickerDemo()),
10441040
),
10451041
],
10461042
category: GalleryDemoCategory.cupertino,
@@ -1056,11 +1052,8 @@ class Demos {
10561052
description: localizations.demoCupertinoScrollbarDescription,
10571053
documentationUrl: '$_docsBaseUrl/cupertino/CupertinoScrollbar-class.html',
10581054
buildRoute:
1059-
(_) => DeferredWidget(
1060-
cupertinoLoader,
1061-
// ignore: prefer_const_constructors
1062-
() => cupertino_demos.CupertinoScrollbarDemo(),
1063-
),
1055+
(_) =>
1056+
DeferredWidget(cupertinoLoader, () => cupertino_demos.CupertinoScrollbarDemo()),
10641057
),
10651058
],
10661059
category: GalleryDemoCategory.cupertino,

dev/integration_tests/new_gallery/lib/routes.dart

+6-19
Original file line numberDiff line numberDiff line change
@@ -55,45 +55,32 @@ class RouteConfiguration {
5555
),
5656
Path(
5757
r'^' + rally_routes.homeRoute,
58-
(BuildContext context, String? match) => StudyWrapper(
59-
study: DeferredWidget(
60-
rally.loadLibrary,
61-
() => rally.RallyApp(),
62-
), // ignore: prefer_const_constructors
63-
),
58+
(BuildContext context, String? match) =>
59+
StudyWrapper(study: DeferredWidget(rally.loadLibrary, () => rally.RallyApp())),
6460
),
6561
Path(
6662
r'^' + shrine_routes.homeRoute,
67-
(BuildContext context, String? match) => StudyWrapper(
68-
study: DeferredWidget(
69-
shrine.loadLibrary,
70-
() => shrine.ShrineApp(),
71-
), // ignore: prefer_const_constructors
72-
),
63+
(BuildContext context, String? match) =>
64+
StudyWrapper(study: DeferredWidget(shrine.loadLibrary, () => shrine.ShrineApp())),
7365
),
7466
Path(
7567
r'^' + crane_routes.defaultRoute,
7668
(BuildContext context, String? match) => StudyWrapper(
7769
study: DeferredWidget(
7870
crane.loadLibrary,
79-
() => crane.CraneApp(), // ignore: prefer_const_constructors
71+
() => crane.CraneApp(),
8072
placeholder: const DeferredLoadingPlaceholder(name: 'Crane'),
8173
),
8274
),
8375
),
8476
Path(
8577
r'^' + fortnightly_routes.defaultRoute,
8678
(BuildContext context, String? match) => StudyWrapper(
87-
study: DeferredWidget(
88-
fortnightly.loadLibrary,
89-
// ignore: prefer_const_constructors
90-
() => fortnightly.FortnightlyApp(),
91-
),
79+
study: DeferredWidget(fortnightly.loadLibrary, () => fortnightly.FortnightlyApp()),
9280
),
9381
),
9482
Path(
9583
r'^' + reply_routes.homeRoute,
96-
// ignore: prefer_const_constructors
9784
(BuildContext context, String? match) =>
9885
const StudyWrapper(study: reply.ReplyApp(), hasBottomNavBar: true),
9986
),

dev/snippets/lib/src/util.dart

-1
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,6 @@ SampleStats getSampleStats(SourceElement element) {
263263

264264
/// Exit the app with a message to stderr.
265265
/// Can be overridden by tests to avoid exits.
266-
// ignore: prefer_function_declarations_over_variables
267266
void Function(String message) errorExit = (String message) {
268267
io.stderr.writeln(message);
269268
io.exit(1);

engine/src/flutter/lib/ui/geometry.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ class Size extends OffsetBase {
357357
///
358358
/// * [Size.fromRadius], which is more convenient when the available size
359359
/// is the radius of a circle.
360-
const Size.square(double dimension) : super(dimension, dimension); // ignore: use_super_parameters
360+
const Size.square(double dimension) : super(dimension, dimension);
361361

362362
/// Creates a [Size] with the given [width] and an infinite [height].
363363
const Size.fromWidth(double width) : super(width, double.infinity);

engine/src/flutter/lib/ui/natives.dart

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
// found in the LICENSE file.
44
part of dart.ui;
55

6-
// ignore_for_file: avoid_classes_with_only_static_members
7-
86
/// Helper functions for Dart Plugin Registrants.
97
abstract final class DartPluginRegistrant {
108
static bool _wasInitialized = false;

engine/src/flutter/lib/web_ui/dev/firefox.dart

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ import 'dart:io';
77

88
import 'package:path/path.dart' as path;
99
import 'package:test_api/backend.dart';
10-
// TODO(ditman): Fix ignore when https://github.com/flutter/flutter/issues/143599 is resolved.
11-
import 'package:test_core/src/util/io.dart'; // ignore: implementation_imports
10+
import 'package:test_core/src/util/io.dart';
1211

1312
import 'browser.dart';
1413
import 'browser_process.dart';

engine/src/flutter/lib/web_ui/dev/steps/run_suite_step.dart

+2-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ import 'package:path/path.dart' as pathlib;
1010
// https://github.com/dart-lang/test/issues/1521
1111
import 'package:skia_gold_client/skia_gold_client.dart';
1212
import 'package:test_api/backend.dart' as hack;
13-
// TODO(ditman): Fix ignores when https://github.com/flutter/flutter/issues/143599 is resolved.
14-
import 'package:test_core/src/executable.dart' as test; // ignore: implementation_imports
15-
import 'package:test_core/src/runner/hack_register_platform.dart'
16-
as hack; // ignore: implementation_imports
13+
import 'package:test_core/src/executable.dart' as test;
14+
import 'package:test_core/src/runner/hack_register_platform.dart' as hack;
1715

1816
import '../browser.dart';
1917
import '../common.dart';

engine/src/flutter/lib/web_ui/dev/test_platform.dart

+6-7
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,12 @@ import 'package:skia_gold_client/skia_gold_client.dart';
2323
import 'package:stream_channel/stream_channel.dart';
2424

2525
import 'package:test_core/backend.dart' hide Compiler;
26-
// TODO(ditman): Fix ignores when https://github.com/flutter/flutter/issues/143599 is resolved.
27-
import 'package:test_core/src/runner/environment.dart'; // ignore: implementation_imports
28-
import 'package:test_core/src/runner/platform.dart'; // ignore: implementation_imports
29-
import 'package:test_core/src/runner/plugin/platform_helpers.dart'; // ignore: implementation_imports
30-
import 'package:test_core/src/runner/runner_suite.dart'; // ignore: implementation_imports
31-
import 'package:test_core/src/util/io.dart'; // ignore: implementation_imports
32-
import 'package:test_core/src/util/stack_trace_mapper.dart'; // ignore: implementation_imports
26+
import 'package:test_core/src/runner/environment.dart';
27+
import 'package:test_core/src/runner/platform.dart';
28+
import 'package:test_core/src/runner/plugin/platform_helpers.dart';
29+
import 'package:test_core/src/runner/runner_suite.dart';
30+
import 'package:test_core/src/util/io.dart';
31+
import 'package:test_core/src/util/stack_trace_mapper.dart';
3332

3433
import 'package:web_socket_channel/web_socket_channel.dart';
3534
import 'package:web_test_utils/image_compare.dart';

engine/src/flutter/lib/web_ui/lib/geometry.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class Size extends OffsetBase {
9090
const Size(super.width, super.height);
9191
// Used by the rendering library's _DebugSize hack.
9292
Size.copy(Size source) : super(source.width, source.height);
93-
const Size.square(double dimension) : super(dimension, dimension); // ignore: use_super_parameters
93+
const Size.square(double dimension) : super(dimension, dimension);
9494
const Size.fromWidth(double width) : super(width, double.infinity);
9595
const Size.fromHeight(double height) : super(double.infinity, height);
9696
const Size.fromRadius(double radius) : super(radius * 2.0, radius * 2.0);

engine/src/flutter/lib/web_ui/lib/natives.dart

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
part of ui;
66

7-
// ignore_for_file: avoid_classes_with_only_static_members
8-
97
/// Helper functions for Dart Plugin Registrants.
108
class DartPluginRegistrant {
119
/// Makes sure the that the Dart Plugin Registrant has been called for this

engine/src/flutter/lib/web_ui/lib/platform_dispatcher.dart

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ typedef PlatformMessageCallback =
1616
void Function(String name, ByteData? data, PlatformMessageResponseCallback? callback);
1717
typedef ErrorCallback = bool Function(Object exception, StackTrace stackTrace);
1818

19-
// ignore: avoid_classes_with_only_static_members
2019
/// A token that represents a root isolate.
2120
class RootIsolateToken {
2221
static RootIsolateToken? get instance {

engine/src/flutter/lib/web_ui/lib/src/engine/canvaskit/canvaskit_api.dart

+3-17
Original file line numberDiff line numberDiff line change
@@ -2756,30 +2756,16 @@ extension SkTextStylePropertiesExtension on SkTextStyleProperties {
27562756

27572757
@JS('shadows')
27582758
external set _shadows(JSArray<JSAny?>? value);
2759-
set shadows(List<SkTextShadow>? value) =>
2760-
// TODO(joshualitt): remove this cast when we reify JS types on JS
2761-
// backends.
2762-
// ignore: unnecessary_cast
2763-
_shadows =
2764-
(value as List<JSAny>?)?.toJS;
2759+
set shadows(List<SkTextShadow>? value) => _shadows = (value as List<JSAny>?)?.toJS;
27652760

27662761
@JS('fontFeatures')
27672762
external set _fontFeatures(JSArray<JSAny?>? value);
2768-
set fontFeatures(List<SkFontFeature>? value) =>
2769-
// TODO(joshualitt): remove this cast when we reify JS types on JS
2770-
// backends.
2771-
// ignore: unnecessary_cast
2772-
_fontFeatures =
2773-
(value as List<JSAny>?)?.toJS;
2763+
set fontFeatures(List<SkFontFeature>? value) => _fontFeatures = (value as List<JSAny>?)?.toJS;
27742764

27752765
@JS('fontVariations')
27762766
external set _fontVariations(JSArray<JSAny?>? value);
27772767
set fontVariations(List<SkFontVariation>? value) =>
2778-
// TODO(joshualitt): remove this cast when we reify JS types on JS
2779-
// backends.
2780-
// ignore: unnecessary_cast
2781-
_fontVariations =
2782-
(value as List<JSAny>?)?.toJS;
2768+
_fontVariations = (value as List<JSAny>?)?.toJS;
27832769
}
27842770

27852771
@JS()

engine/src/flutter/lib/web_ui/lib/src/engine/dom.dart

-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ extension DomWindowExtension on DomWindow {
158158
message.toJSAnyShallow,
159159
targetOrigin.toJS,
160160
// Cast is necessary so we can call `.toJS` on the right extension.
161-
// ignore: unnecessary_cast
162161
(messagePorts as List<JSAny>).toJS,
163162
);
164163
}

engine/src/flutter/lib/web_ui/lib/src/engine/html/renderer.dart

+1-2
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,7 @@ class HtmlRenderer implements Renderer {
140140
required ui.ImageFilter outer,
141141
required ui.ImageFilter inner,
142142
}) {
143-
// TODO(ferhat): add implementation and remove the "ignore".
144-
// ignore: avoid_unused_constructor_parameters
143+
// TODO(ferhat): add implementation.
145144
throw UnimplementedError('ImageFilter.erode not implemented for HTML renderer.');
146145
}
147146

engine/src/flutter/lib/web_ui/lib/src/engine/safe_browser_api.dart

-1
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,6 @@ class GlContext {
869869
}
870870
}
871871

872-
// ignore: avoid_classes_with_only_static_members
873872
/// Creates gl context from cached OffscreenCanvas for webgl rendering to image.
874873
class GlContextCache {
875874
static int _maxPixelWidth = 0;

engine/src/flutter/lib/web_ui/lib/src/engine/skwasm/skwasm_impl.dart

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
@DefaultAsset('skwasm')
66
// The web_sdk/sdk_rewriter.dart uses this directive.
7-
// ignore: unnecessary_library_directive
87
library skwasm_impl;
98

109
import 'dart:ffi';

engine/src/flutter/lib/web_ui/lib/src/engine/skwasm/skwasm_impl/vertices.dart

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
// ignore_for_file: avoid_unused_constructor_parameters
6-
75
import 'dart:ffi';
86
import 'dart:typed_data';
97

engine/src/flutter/lib/web_ui/lib/src/engine/view_embedder/dimensions_provider/custom_element_dimensions_provider.dart

-2
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ class CustomElementDimensionsProvider extends DimensionsProvider {
7474
void close() {
7575
super.close();
7676
_hostElementResizeObserver?.disconnect();
77-
// ignore:unawaited_futures
7877
_dprChangeStreamSubscription?.cancel();
79-
// ignore:unawaited_futures
8078
_onResizeStreamController.close();
8179
}
8280

engine/src/flutter/lib/web_ui/lib/src/engine/view_embedder/dimensions_provider/full_page_dimensions_provider.dart

-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ class FullPageDimensionsProvider extends DimensionsProvider {
5151
void close() {
5252
super.close();
5353
_domResizeSubscription.cancel();
54-
// ignore:unawaited_futures
5554
_onResizeStreamController.close();
5655
}
5756

engine/src/flutter/lib/web_ui/test/common/matchers.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ double _rectDistance(Rect a, Rect b) {
110110
}
111111

112112
double _sizeDistance(Size a, Size b) {
113-
final Offset delta = (b - a) as Offset; // ignore: unnecessary_parenthesis
113+
final Offset delta = (b - a) as Offset;
114114
return delta.distance;
115115
}
116116

engine/src/flutter/lib/web_ui/test/engine/channel_buffers_test.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ void testMain() {
191191
}
192192

193193
void twoCallback(ByteData? responseData) {
194-
throw TestFailure('wrong callback called'); // ignore: only_throw_errors
194+
throw TestFailure('wrong callback called');
195195
}
196196

197197
_resize(buffers, channel, 100);
@@ -214,7 +214,7 @@ void testMain() {
214214
}
215215

216216
void twoCallback(ByteData? responseData) {
217-
throw TestFailure('wrong callback called'); // ignore: only_throw_errors
217+
throw TestFailure('wrong callback called');
218218
}
219219

220220
_resize(buffers, channel, 1);

engine/src/flutter/lib/web_ui/test/ui/canvas_test.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Future<void> testMain() async {
4646
} on TestFailure {
4747
return;
4848
}
49-
throw TestFailure('transforms were too close to equal'); // ignore: only_throw_errors
49+
throw TestFailure('transforms were too close to equal');
5050
}
5151

5252
test('ui.Canvas.translate affects canvas.getTransform', () {
@@ -136,7 +136,7 @@ Future<void> testMain() async {
136136
} on TestFailure {
137137
return;
138138
}
139-
throw TestFailure('transforms were too close to equal'); // ignore: only_throw_errors
139+
throw TestFailure('transforms were too close to equal');
140140
}
141141

142142
group('ui.Canvas clip tests', () {

engine/src/flutter/testing/dart/image_filter_test.dart

-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ void main() async {
159159

160160
List<ColorFilter> colorFilters() {
161161
// Create new color filter instances on each invocation.
162-
// ignore: prefer_const_constructors
163162
return <ColorFilter>[
164163
ColorFilter.mode(green, BlendMode.color), // ignore: prefer_const_constructors
165164
ColorFilter.mode(red, BlendMode.color), // ignore: prefer_const_constructors

engine/src/flutter/testing/dart/spawn_test.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,5 +75,5 @@ void main() {
7575
final Pointer<Utf8> fakePath = 'fake-path'.toNativeUtf8();
7676
expect(_loadLibraryFromKernel(fakePath), null);
7777
malloc.free(fakePath);
78-
}, skip: kProfileMode || kReleaseMode); // ignore: avoid_redundant_argument_values
78+
}, skip: kProfileMode || kReleaseMode);
7979
}

engine/src/flutter/tools/const_finder/test/fixtures/lib/consts.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
// ignore_for_file: prefer_const_constructors, unused_local_variable, depend_on_referenced_packages
5+
// ignore_for_file: prefer_const_constructors, unused_local_variable
66
import 'dart:core';
77

88
import 'package:const_finder_fixtures_package/package.dart';

0 commit comments

Comments
 (0)