Skip to content

Enable the avoid_final_parameters lint.#185216

Draft
kallentu wants to merge 4 commits intoflutter:masterfrom
kallentu:primary-constructor-final
Draft

Enable the avoid_final_parameters lint.#185216
kallentu wants to merge 4 commits intoflutter:masterfrom
kallentu:primary-constructor-final

Conversation

@kallentu
Copy link
Copy Markdown
Contributor

@kallentu kallentu commented Apr 17, 2026

avoid_final_parameters lint fires when using a final modifier in any parameter list. This is a preparatory lint that helps us migrate to Dart 3.13. All violations from this lint will become compile-time errors in Dart 3.13 when the primary constructors feature ships.

Fixes: dart-lang/sdk#62590

Related to breaking changes: There should be nothing that breaks from adding this lint. Function types with final are already a compile-time error and any customers overriding a method with a final parameter won't break their code.

// Framework code
class C {
  void m(int x) { ... } // Removed var here.
}
// ...

// User code
class B implements C {
  void m(final int x) { ... } // Will still work.
}

This change should be test exempt.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

@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. d: examples Sample code and demos platform-web Web applications specifically labels Apr 17, 2026
@kallentu kallentu added the CICD Run CI/CD label Apr 17, 2026
@github-actions github-actions bot added platform-windows Building on or for Windows specifically a: desktop Running on desktop team-windows Owned by the Windows platform team and removed CICD Run CI/CD labels Apr 17, 2026
@kallentu kallentu added the CICD Run CI/CD label Apr 17, 2026
@github-actions github-actions bot removed the CICD Run CI/CD label Apr 17, 2026
@kallentu kallentu added the CICD Run CI/CD label Apr 17, 2026
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 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.

[Primary Constructors] Pre-release migrations

1 participant