Skip to content

proposal: no constructor should give const suggestion?Β #57107

@stephane-archer

Description

@stephane-archer

moving from:

class _FalseColorSwitch extends StatelessWidget {

  @override
  Widget build(BuildContext context) {

to

class _FalseColorSwitch extends StatelessWidget {
  const _FalseColorSwitch(); // adding a const constructor that does nothing

  @override
  Widget build(BuildContext context) {

give me so many linter optimization suggestions:

Use 'const' with the constructor to improve performance.
Try adding the 'const' keyword to the constructor invocation.

I think no constructor should give me the same recommendation as a const constructor that does nothing. is there an actual difference?

Metadata

Metadata

Assignees

No one assigned

    Labels

    devexp-linterIssues with the analyzer's support for the linter packagelegacy-area-analyzerUse area-devexp instead.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions