Skip to content

Revert "[CP-beta] Enable the avoid_final_parameters lint. (#185216)"#186270

Merged
auto-submit[bot] merged 1 commit into
flutter-3.44-candidate.0from
revert-186199-dart-lint
May 8, 2026
Merged

Revert "[CP-beta] Enable the avoid_final_parameters lint. (#185216)"#186270
auto-submit[bot] merged 1 commit into
flutter-3.44-candidate.0from
revert-186199-dart-lint

Conversation

@walley892

@walley892 walley892 commented May 8, 2026

Copy link
Copy Markdown
Contributor

Reverts #186199. These lint changes aren't necessary for the intended dart version

@walley892 walley892 requested a review from a team as a code owner May 8, 2026 19:43
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label May 8, 2026
@flutter-dashboard

Copy link
Copy Markdown

This pull request was opened from and to a release candidate branch. This should only be done as part of the official Flutter release process. If you are attempting to make a regular contribution to the Flutter project, please close this PR and follow the instructions at Tree Hygiene for detailed instructions on contributing to Flutter.

Reviewers: Use caution before merging pull requests to release branches. Ensure the proper procedure has been followed.

@github-actions github-actions Bot added a: text input Entering text in a text field or keyboard related problems tool Affects the "flutter" command-line tool. See also t: labels. framework flutter/packages/flutter repository. See also f: labels. engine flutter/engine related. See also e: labels. a: animation Animation APIs f: material design flutter/packages/flutter/material repository. f: scrolling Viewports, list views, slivers, etc. platform-windows Building on or for Windows specifically d: examples Sample code and demos platform-web Web applications specifically a: desktop Running on desktop team-windows Owned by the Windows platform team labels May 8, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates analysis_options.yaml to disable the avoid_final_parameters lint and applies the final keyword to parameters in various files across the repository. Review feedback points out that these changes conflict with the Flutter style guide's recommendation to avoid final for parameters to reduce visual noise. The feedback also highlights inconsistencies in function signatures where final was applied only to a subset of parameters and notes that the justification provided in the configuration file is misleading regarding lint compatibility.

Comment thread analysis_options.yaml
- avoid_field_initializers_in_const_classes
# TODO(kallentu): Remove this lint once the Dart SDK in Flutter is on version 3.13.
- avoid_final_parameters
# - avoid_final_parameters # incompatible with prefer_final_parameters

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The comment added here is misleading. avoid_final_parameters is not incompatible with prefer_final_parameters in a way that justifies disabling it if the goal is to follow the Flutter style guide. In fact, the Flutter style guide (referenced in the Repository Style Guide) explicitly recommends avoiding final for parameters. If this lint must be disabled for SDK compatibility reasons on this branch, the comment should clarify that instead of referencing an unused lint rule.

References
  1. The Flutter style guide recommends avoiding the use of 'final' for parameters and local variables to reduce visual noise and maintain a consistent style across the repository. (link)

Comment on lines +222 to +225
final ValueChanged<DatePickerEntryMode>? onDatePickerModeChange,
final Icon? switchToInputEntryModeIcon,
final Icon? switchToCalendarEntryModeIcon,
final CalendarDelegate<DateTime> calendarDelegate = const GregorianCalendarDelegate(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This change introduces an inconsistency in the function signature. Parameters on lines 219-221 are not marked final, while these are. Additionally, the Flutter style guide recommends avoiding final for parameters. It is better to omit the final keyword here to maintain consistency and adhere to the repository's style guidelines.

  ValueChanged<DatePickerEntryMode>? onDatePickerModeChange,
  Icon? switchToInputEntryModeIcon,
  Icon? switchToCalendarEntryModeIcon,
  CalendarDelegate<DateTime> calendarDelegate = const GregorianCalendarDelegate(),
References
  1. The Flutter style guide recommends avoiding the use of 'final' for parameters and local variables. (link)

Comment on lines +1193 to +1194
final Icon? switchToInputEntryModeIcon,
final Icon? switchToCalendarEntryModeIcon,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Inconsistent use of final for parameters in this function signature (compare with lines 1190-1192 and 1195). Following the Flutter style guide, final should be omitted for parameters.

  Icon? switchToInputEntryModeIcon,
  Icon? switchToCalendarEntryModeIcon,
References
  1. The Flutter style guide recommends avoiding the use of 'final' for parameters and local variables. (link)


void validatePropertyJsonSerializationHelper(
Map<String, Object?> json,
final Map<String, Object?> json,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Inconsistent use of final for parameters in this function signature (json is final, but property is not). Per the Flutter style guide, final should be avoided for parameters.

Suggested change
final Map<String, Object?> json,
Map<String, Object?> json,
References
  1. The Flutter style guide recommends avoiding the use of 'final' for parameters and local variables. (link)

final Key textFieldKey = UniqueKey();

Widget builder(int? maxLines, String hintMsg) {
Widget builder(int? maxLines, final String hintMsg) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Inconsistent use of final for parameters in the builder function (maxLines is not final, but hintMsg is). Per the Flutter style guide, final should be avoided for parameters.

    Widget builder(int? maxLines, String hintMsg) {
References
  1. The Flutter style guide recommends avoiding the use of 'final' for parameters and local variables. (link)

String fileName,
String header,
LocaleInfo locale,
final LocaleInfo locale,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Inconsistent use of final for parameters. Only locale is marked final while the other parameters in this method are not. Following the Flutter style guide, final should be omitted.

Suggested change
final LocaleInfo locale,
LocaleInfo locale,
References
  1. The Flutter style guide recommends avoiding the use of 'final' for parameters and local variables. (link)

@walley892 walley892 added the autosubmit Merge PR when tree becomes green via auto submit App label May 8, 2026
@auto-submit auto-submit Bot merged commit f1a5619 into flutter-3.44-candidate.0 May 8, 2026
180 checks passed
@auto-submit auto-submit Bot deleted the revert-186199-dart-lint branch May 8, 2026 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: animation Animation APIs a: desktop Running on desktop a: text input Entering text in a text field or keyboard related problems autosubmit Merge PR when tree becomes green via auto submit App CICD Run CI/CD d: examples Sample code and demos engine flutter/engine related. See also e: labels. f: material design flutter/packages/flutter/material repository. f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels. platform-web Web applications specifically platform-windows Building on or for Windows specifically team-windows Owned by the Windows platform team tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants