Open
Description
Not sure whether this is the right place for the issue, so tell me if I'm in the wrong place.
Version: Dart SDK version: 2.12.0-29.10.beta (beta) (Tue Nov 17 10:50:22 2020 +0100) on "linux_x64"
I have this class that I want to initialize using named parameters, and using those parameters I create the final variable in the initialization list.
But whatever I try, it doesn't seem to work. I have it narrowed down to the following example:
class Class1 {
const Class1({this.variable});
final int variable;
}
class Class2 {
const Class2({
int variable,
}) : class1 = const Class1(variable: const variable);
final Class1 class1;
}
But when creating the class1
I'm getting the following error:
The constructor returns type 'dynamic' that isn't of expected type 'int'.
When I remove the const however, I get this:
Invalid constant value.
What am I missing here?