Repository navigation
Description
This issue tracks migrations and work that is needed before shipping/flipping the flag.
- Migration on all the places where we are marking formal parameters as final. Missing fix for
avoid_final_parameters#61812 - Migration on all formal parameters with no type annotation marked with the
varkeyword.
Context: #61525 (comment)
It used to be possible to mark formal parameters (in general, not just the ones in constructors) as final. This used to mean that the formal parameter itself was immutable. However, we decided that this feature should no longer be supported, which means that it will be an error to put final on a formal parameter of any function other than a declaring constructor
This does give rise to some inconveniences for developers who prefer to use immutable formal parameters (they're forced to change their code to not do that any more). However, final formal parameters are not common today, and it's not hard to teach dart fix to remove final in the locations where it is an error to have it.
- Make sure there's a migration path for the
factory()breakages. [Primary Constructors] Warning for ambiguous factory method/factory constructor #61910- There seem to be none in g3.
- Prepare flutter/flutter repo for primary constructors. Add
avoid_final_parameterslint andvar_with_no_type_annotation
Activity
lrhn commentedon Feb 5, 2026
Also need to migrate any (hypothetical) parameters of the form
var id.There was never any reason to write the
var, so it's likely incredibly rare, but it has also always been valid syntax.If nothing else, the SDK might have tests of the syntax that should be marked as legacy tests with a language version marker.
kallentu commentedon Feb 5, 2026
Ah good point. I'll check if there are any instances of that.
eernstg commentedon Feb 6, 2026
https://dart-review.googlesource.com/c/sdk/+/456740 should have removed
varandfinalparameters from language tests. If it's important to have the old syntax (especially,var myParameter) and equip them with a language version then those old tests can be found in the commit just before that CL was landed.kallentu commentedon Apr 13, 2026
Both
var_with_no_type_annotationandavoid_final_parameterlints are enabled in g3.Enable `var_with_no_type_annotation` lint. (flutter#185215)
Enable the `avoid_final_parameters` lint. (flutter#185216)
Enable the `avoid_final_parameters` lint. (#185216)