isSubtypeOf method
An enum is a subtype of itself, of Enum and Object, and of every
mixin it applies and interface it implements, with their supertypes
(ghissues19: it answered only for itself and Object, so E.a is C was
false and a C parameter refused E.a).
Implementation
@override
bool isSubtypeOf(RuntimeType other, {Object? value}) {
if (identical(this, other) ||
other.name == 'Object' ||
other.name == 'Enum') {
return true;
}
for (final RuntimeType supertype in [
...mixins,
...bridgedMixins,
...interfaces,
...bridgedInterfaces,
]) {
if (identical(supertype, other) || supertype.isSubtypeOf(other)) {
return true;
}
}
return false;
}