I've been trying to get this right for some time and can't figure out what is wrong.
enum MyEnum { a, b }
class ClassA {
final MyEnum myEnum;
ClassA({this.myEnum = MyEnum.a});
}
class ClassB {
final ClassA classA;
ClassB({this.classA = ClassA()}); // ClassA expression is underlined with red
}
The IDE (Visual Studio Code) complains with:
[dart] Default values of an optional parameter must be constant.
I've tried to prefix it with const, new, and passing values to the ClassA constructor, but nothing works. Can anyone see what I am doing wrong here?