class_ used_ as_ mixin
Details about the 'class_used_as_mixin' diagnostic produced by the Dart analyzer.
The class '{0}' can't be used as a mixin because it's neither a mixin class nor a mixin.
Description
#
The analyzer produces this diagnostic when a class that is
neither a
mixin class nor a mixin is used in a
with clause.
Example
#
The following code produces this diagnostic because the class
M is being used as a mixin, but it isn't defined
as a mixin class:
class M {}
class C with M {}
Common fixes
#
If the class can be a pure mixin, then change
class to mixin:
mixin M {}
class C with M {}
If the class needs to be both a class and a mixin, then add
mixin:
mixin class M {}
class C with M {}
除非另有说明,文档之所提及适用于 Dart 3.12.2 版本报告页面问题.