Skip to content

Surface whether or not a getter can be overridden #1103

Open
@nex3

Description

@nex3

In strong mode, a getter may not be overridden if it's defined as a field. For example,

class Super {
  final foo;
  get bar;
}

class Sub extends Super {
  get foo => 12;
  get bar => 13
}

Sub.foo is invalid, whereas Sub.bar is valid. This affects the public API of a class, so it should be mentioned in the documentation. For forwards-compatibility with future explicit member- or class-level control of virtual-ness, it would probably be good to document this as "this getter cannot be overidden in subclasses" or something like that.

cc @munificent @vsmenon

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requesttype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions