Restricted classes used in inheritance and implementation clausesDRT-W1625
The analyzer produces this diagnostic when one of the restricted classes is
used in either an extends
, implements
, with
, or on
clause. The
classes bool
, double
, FutureOr
, int
, Null
, num
, and String
are all restricted in this way, to allow for more efficient
implementations.
Examples
The following code produces this diagnostic because String
is used in an
extends
clause:
class A extends String {}
The following code produces this diagnostic because String
is used in an
implements
clause:
class B implements String {}
The following code produces this diagnostic because String
is used in a
with
clause:
class C with String {}
The following code produces this diagnostic because String
is used in an
on
clause:
mixin M on String {}
Common fixes
If a different type should be specified, then replace the type:
class A extends Object {}
If there isn't a different type that would be appropriate, then remove the type, and possibly the whole clause:
class B {}