Skip to content

Setting of super.named parameter is recognized as unused or incorrect #59792

Closed
@ChaserVasya

Description

@ChaserVasya

Snippet

class A{
  final bool b;

  A({this.b = false});
}


class _B extends A{
  _B({super.b = true});
}

class _C extends A{
  _C(): super.b = true;
}

void fn(){
  _B(); 
  _C();
}

What I want

I want to avoid _B({b: true}) when I can set in constructor and to pass analyzer lints

Problem

B.b: is unused. (Okay. It looks like expected. But it has not hotfix by analyzer and I create hotfix as _C class)
C.b: error: 'b' isn't a field in the enclosing class.

Снимок экрана 2024-12-22 в 14 42 53

Version

Dart SDK version: 3.5.4 (stable) (Wed Oct 16 16:18:51 2024 +0000) on "macos_arm64"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions