Update the primary constructors proposal #3836
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR makes adjustments to the proposal about primary constructors such that it is in line with the results from discussions at the recent physical language team meeting.
In particular, it removes support for a
primary
constructor which is declared in the body of the class/enum/etc, and only allows for the form which is part of the header of the class declaration. It also removes the ability to infer the modifierrequired
in a formal parameter declaration.(Inferred
required
is now a separate proposal, see https://github.com/dart-lang/language/blob/main/working/0015-infer-required/feature-specification.md.)It preserves the ability to omit
final
from every parameter when the primary constructor is constant, because we already have the ability to omitfinal
in the primary constructor of an extension type declaration.