Skip to content

Support primary constructors - #1397

Closed
donny-dont wants to merge 1 commit into
google:masterfrom
donny-dont:fix-dart-primary-constructors
Closed

donny-dont wants to merge 1 commit into
google:masterfrom
donny-dont:fix-dart-primary-constructors

Conversation

@donny-dont

Copy link
Copy Markdown
Contributor

Change the check for the _ value constructor to support new _().

Change the check for the `_` value constructor to support `new _()`.
@donny-dont

Copy link
Copy Markdown
Contributor Author

The check for the factory constructor works with the primary constructor feature of dart 3.13 out of the box so just targeting the _ constructor.

@davidmorgan

Copy link
Copy Markdown
Collaborator

Thanks! I will take a look, probably there is additional work that is useful with this.

@donny-dont

Copy link
Copy Markdown
Contributor Author

@davidmorgan is there anything I can do to move things along? Without this change anyone trying to use built value classes cannot update to the new primary constructor format. The generator will refuse to accept the new syntax as being valid.

@davidmorgan

Copy link
Copy Markdown
Collaborator

@donny-dont commenting here is a good way :) I'll try to get to it this week. Thanks :)

@donny-dont

Copy link
Copy Markdown
Contributor Author

@davidmorgan sounds good!

I don't know what Dart SDK's this is tested against but if its sdk: ^3.13 then I could bump the internal end to end examples to that and then write a test that uses the primary constructors. I did notice that the examples used older versions of some dart packages like having pedantic instead of lints. Might be a good excuse to bump those to use more recent Dart language features.

@donny-dont

Copy link
Copy Markdown
Contributor Author

Looks like you've got this covered in #1400 so I'm going to close this and let you do your thing! Thanks for getting this figured out!

@donny-dont donny-dont closed this Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants