Skip to content

Incorrect invalid_constant error when using an import prefix #61714

@rrousselGit

Description

@rrousselGit

Consider:

import 'foo.dart' as prefix;
import 'foo.dart';

class Bar {
  const Bar():
    value = prefix.Foo.staticVariable;

  final Object? value;
}

class Baz {
  const Baz():
    value = Foo.staticVariable;

  final Object? value;
}

While Baz works, Bar doesn't:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions