The following code will not run:
class X{
double? x;
}
mixin Y{
double? y;
}
class Z extends X with Y {
double? z;
Z(this.x, this.y, this.z)
}
The compiler will complain that this.x and this.y are not fields in the enclosing class:
lib/physicalObject.dart:20:10: Error: 'x' isn't an instance field of this class.
Z(this.x, this.y, this.z)
^
lib/physicalObject.dart:20:18: Error: 'y' isn't an instance field of this class.
Z(this.x, this.y, this.z)
^
Of course this is not true, the fields x and y are inherited from the parent class and mixin. I can use these fields within the child class Z, it seems it is only the constructor, which has a problem accepting these as parameters. But why?