isEquivalentTo<U> method

bool isEquivalentTo<U>(
  1. RuntimeType<U> other
)

Whether this type is equivalent to other.

Unlike Type.operator==, this returns true if this and other are subtypes of each other. The most obvious scenario where this is true is when this == other, but other cases, such as dynamic and Object? do exist.

Implementation

bool isEquivalentTo<U>(RuntimeType<U> other) => other.isSupertypeOf(this) && isSupertypeOf(other);