isSubtypeOf method

  1. @override
bool isSubtypeOf(
  1. RuntimeType other, {
  2. Object? value,
})
override

Checks if this type is a subtype of other.

Implementation

@override
bool isSubtypeOf(RuntimeType other, {Object? value}) {
  // DFUB7: a type parameter is trivially a subtype of another type parameter.
  if (other is TypeParameter) return true;
  // Bounded (`T extends X`): T is a subtype of `other` exactly when its bound
  // is — e.g. `T extends num` is not a subtype of `String`.
  if (bound != null) return bound!.isSubtypeOf(other, value: value);
  // Unbounded (`T`, implicitly `T extends Object?`): only the top types.
  return _isTopType(other);
}