Skip to content

Commit 009ba9e

Browse files
authored
[CP-beta] Enable the avoid_final_parameters lint. (#185216) (#186199)
Manual cherry pick of #185216 so we can update the dart deps to https://dart.googlesource.com/sdk/+/refs/heads/lkgr-beta
1 parent 74367df commit 009ba9e

23 files changed

Lines changed: 59 additions & 59 deletions

File tree

analysis_options.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ linter:
5555
- avoid_equals_and_hash_code_on_mutable_classes
5656
- avoid_escaping_inner_quotes
5757
- avoid_field_initializers_in_const_classes
58-
# - avoid_final_parameters # incompatible with prefer_final_parameters
58+
# TODO(kallentu): Remove this lint once the Dart SDK in Flutter is on version 3.13.
59+
- avoid_final_parameters
5960
- avoid_function_literals_in_foreach_calls
6061
# - avoid_futureor_void # not yet tested
6162
# - avoid_implementing_value_types # see https://github.com/dart-lang/linter/issues/4558

dev/benchmarks/complex_layout/test/measure_scroll_smoothness.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ import 'package:integration_test/integration_test.dart';
1515
/// Generates the [PointerEvent] to simulate a drag operation from
1616
/// `center - totalMove/2` to `center + totalMove/2`.
1717
Iterable<PointerEvent> dragInputEvents(
18-
final Duration epoch,
19-
final Offset center, {
20-
final Offset totalMove = const Offset(0, -400),
21-
final Duration totalTime = const Duration(milliseconds: 2000),
22-
final double frequency = 90,
18+
Duration epoch,
19+
Offset center, {
20+
Offset totalMove = const Offset(0, -400),
21+
Duration totalTime = const Duration(milliseconds: 2000),
22+
double frequency = 90,
2323
}) sync* {
2424
final Offset startLocation = center - totalMove / 2;
2525
// The issue is about 120Hz input on 90Hz refresh rate device.

dev/bots/suite_runners/run_test_harness_tests.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ Future<void> _validateEngineRevision() async {
175175
}
176176
final String actualVersion;
177177
try {
178-
actualVersion = result.flattenedStderr!.split('\n').firstWhere((final String line) {
178+
actualVersion = result.flattenedStderr!.split('\n').firstWhere((String line) {
179179
return line.startsWith('Flutter Engine Version:');
180180
});
181181
} on StateError {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2716,7 +2716,7 @@ class EditableTextGeometry {
27162716
assert(encodedGeometry.containsKey('transform'));
27172717

27182718
final transformList = List<double>.from(
2719-
encodedGeometry.readList('transform').map((final dynamic e) => (e as num).toDouble()),
2719+
encodedGeometry.readList('transform').map((dynamic e) => (e as num).toDouble()),
27202720
);
27212721
return EditableTextGeometry(
27222722
width: encodedGeometry.readDouble('width'),

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ class HtmlPatternMatcher extends Matcher {
257257
final html.Element pattern;
258258

259259
@override
260-
bool matches(final Object? object, Map<Object?, Object?> matchState) {
260+
bool matches(Object? object, Map<Object?, Object?> matchState) {
261261
// TODO(srujzs): Replace this with `!object.isJSAny` once we have that API
262262
// in `dart:js_interop`.
263263
// https://github.com/dart-lang/sdk/issues/56905

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ ui.Picture drawPicture(void Function(ui.Canvas) drawCommands) {
663663
return recorder.endRecording();
664664
}
665665

666-
ui.Scene backdropBlurWithTileMode(ui.TileMode? tileMode, final double rectSize, final int count) {
666+
ui.Scene backdropBlurWithTileMode(ui.TileMode? tileMode, double rectSize, int count) {
667667
final double imgSize = rectSize * count;
668668

669669
const white = ui.Color(0xFFFFFFFF);

engine/src/flutter/shell/platform/windows/fixtures/main.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,11 +421,10 @@ Future<void> sendSemanticsTreeInfo() async {
421421

422422
final Iterable<ui.FlutterView> views = ui.PlatformDispatcher.instance.views;
423423
final ui.FlutterView view1 = views.firstWhere(
424-
(final ui.FlutterView view) => view != ui.PlatformDispatcher.instance.implicitView,
424+
(ui.FlutterView view) => view != ui.PlatformDispatcher.instance.implicitView,
425425
);
426426
final ui.FlutterView view2 = views.firstWhere(
427-
(final ui.FlutterView view) =>
428-
view != view1 && view != ui.PlatformDispatcher.instance.implicitView,
427+
(ui.FlutterView view) => view != view1 && view != ui.PlatformDispatcher.instance.implicitView,
429428
);
430429

431430
ui.SemanticsUpdate createSemanticsUpdate(int nodeId) {

examples/image_list/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin {
154154
});
155155
}
156156

157-
Widget createImage(final int index, final Completer<bool> completer) {
157+
Widget createImage(int index, Completer<bool> completer) {
158158
return Image.network(
159159
'https://localhost:${widget.port}/${_counter * images + index}',
160160
frameBuilder: (BuildContext context, Widget child, int? frame, bool wasSynchronouslyLoaded) {

examples/multiple_windows/lib/app/popup_button.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ class _PopupButtonState extends State<PopupButton> {
3333
}
3434

3535
void _onPressed(
36-
final WindowRegistry windowRegistry,
37-
final WindowSettings windowSettings,
36+
WindowRegistry windowRegistry,
37+
WindowSettings windowSettings,
3838
) {
3939
// Toggle popup visibility.
4040
if (_popupWindowEntry != null) {

examples/multiple_windows/lib/app/tooltip_button.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ class _TooltipButtonState extends State<TooltipButton> {
3232
}
3333

3434
void _onPressed(
35-
final WindowRegistry windowRegistry,
36-
final WindowSettings windowSettings,
35+
WindowRegistry windowRegistry,
36+
WindowSettings windowSettings,
3737
) {
3838
// Toggle tooltip visibility.
3939
if (_tooltipEntry != null) {

0 commit comments

Comments
 (0)