Skip to content

Cannot use factory constructor in augmented class #55432

Open
@goderbauer

Description

@goderbauer
class Bar {
}

augment class Bar {
  const factory Bar() = Foo; // 🔥 warning: error: The name of a factory constructor must be the same as the name of the immediately enclosing class. (invalid_factory_name_not_a_class at [macros_playground] lib/main.dart:26)
}

class Foo implements Bar {
  const Foo();
}

The analyzer complains about the line marked with 🔥.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-languageDart language related items (some items might be better tracked at github.com/dart-lang/language).cfe-feature-macrosImplement macros features in the CFEcustomer-flutter-widget-macroIssues related to the flutter stateful widget macrofeature-macrosImplementation of the macros featurelegacy-area-front-endLegacy: Use area-dart-model instead.

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions