isSubtypeOf method
Checks if this type is a subtype of other.
Implementation
@override
bool isSubtypeOf(RuntimeType other, {Object? value}) {
if (other.name == 'Object' || other == this) return true;
// ghissues21: two BridgedEnum objects over the same native enum are one
// type (an alias, or a second registration of the enum).
if (other is BridgedEnum && _sameNativeEnum(other)) return true;
// Allow runtime hierarchy checks for interfaces/superclasses the native
// enum implements (e.g. WidgetState implements WidgetStatesConstraint).
// We delegate to BridgedClass.isAssignable using the underlying native
// enum value, which mirrors how BridgedClass.isSubtypeOf handles
// BridgedInstance values.
if (other is BridgedClass && other.isAssignable != null) {
final nativeValue = value is BridgedEnumValue ? value.nativeValue : value;
if (nativeValue != null && other.isAssignable!(nativeValue)) {
return true;
}
}
return false;
}