Skip to content

analyzer unhappy with super params and const expressions #48719

@goderbauer

Description

@goderbauer
class Color {
  const Color(this.value);

  final int value;
}

class ColorSwatch<T> extends Color {
  const ColorSwatch(super.primary);
}


// 🔥 error: Evaluation of this constant expression throws an exception. (const_eval_throws_exception at [test] lib/pure_dart.dart:13)
const ColorSwatch<int> blue = ColorSwatch<int>(0xFF2196F3);

void main() {
  print(blue);
}

The code above runs fine on the dart VM, but the analyzer thinks there's an error (see comment in code above).

Metadata

Metadata

Assignees

Labels

P2A bug or feature request we're likely to work onlegacy-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