Is it a bug or a feature?
mixin A {
int get prop => 1;
}
class B with A {
const B();
}
_-> Const constructor can't be declared for a class with a mixin that declares an instance field_
But this works!
class A {
const A();
int get prop => 1;
}
class B extends A {
const B();
}
This is a bug, int get prop => 1; does not declare an instance field. In commit 578fa6bee9eb8917ed868bf4b6daafecfe2be491 the error is reported by the analyzer, but not by dart.
Thanks for reporting this issue! This is a duplicate of https://github.com/dart-lang/sdk/issues/37810
Duplicate of https://github.com/dart-lang/sdk/issues/37810
Most helpful comment
This is a bug,
int get prop => 1;does not declare an instance field. In commit 578fa6bee9eb8917ed868bf4b6daafecfe2be491 the error is reported by the analyzer, but not bydart.