mixin M {
M.baz();
}
class MA with M {}
void main(){}
gives a warning of
main.dart:2:3: Error: Mixins can't declare constructors.
M.baz();
^
main.dart:5:7: Error: Can't use 'M' as a mixin because it has constructors.
class MA with M {}
^
main.dart:2:3: Context: This constructor prevents using 'M' as a mixin.
M.baz();
^
The error in line 5, "Can't use 'M' as a mixin because it has constructors.", feels misplaced.
The mixin M doesn't have constructors, because mixins can't have constructors. That's not preventing using it as a mixin, it's preventing the program from compiling.
The only real error, and the only one reported by the analyzer, is that mixin M can't declare a constructor.
gives a warning of
The error in line 5, "Can't use 'M' as a mixin because it has constructors.", feels misplaced. The mixin
M
doesn't have constructors, because mixins can't have constructors. That's not preventing using it as a mixin, it's preventing the program from compiling.The only real error, and the only one reported by the analyzer, is that
mixin M
can't declare a constructor.