Skip to content

Add lint unnecessary_constructor_name - Use A() over A.new() #785

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
natebosch opened this issue Nov 14, 2022 · 4 comments · Fixed by dart-archive/lints#136
Closed

Add lint unnecessary_constructor_name - Use A() over A.new() #785

natebosch opened this issue Nov 14, 2022 · 4 comments · Fixed by dart-archive/lints#136

Comments

@natebosch
Copy link
Member

https://dart-lang.github.io/linter/lints/unnecessary_constructor_name.html

The constructor tearoffs feature added one bit of useless syntax for consistency sake. We should recommend the lint which avoids the useless .new, and allows it only when it's necessary for a tearoff.

@lrhn
Copy link
Member

lrhn commented Jun 7, 2023

For now, that's the only necessary use.
Hopefully we'll get generic constructors eventually, then you might also need it for that.

@natebosch
Copy link
Member Author

Hopefully we'll get generic constructors eventually, then you might also need it for that.

I think we'd update the lint to allow the syntax if it is being used to pass type arguments.

@devoncarew
Copy link
Member

Approved for recommended.

@devoncarew
Copy link
Member

It looks like this was already added in dart-archive/lints#72.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants