Skip to content

lint to discourage .new constructor declarations? #58494

@pq

Description

@pq

With constructor tear-offs, there is a "new" way to define the unnamed constructor for a class.

class A {
  A.new();
}

It's a little surprising that this is equivalent to the shorter version:

class A {
  A();
}

We might consider a lint to discourage people from using this new syntax.

See also: dart-lang/site-www#3525

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions