isEquivalent method
Checks for equivalence, if the instances are similar:
Object
anddynamic
are equivalent.- A type without arguments will be the equivalent of one with only
dynamic
andObject
arguments.
NOTE: Equality from operator == will check if other
is exactly the same.
Implementation
bool isEquivalent(TypeInfo other) {
if (identical(this, other)) return true;
if (_typeWrapper != other._typeWrapper) {
if (_typeWrapper.isDynamicOrObject &&
other._typeWrapper.isDynamicOrObject) {
return true;
} else {
return false;
}
}
var args1 = _arguments;
var args2 = other._arguments;
if (args1.isEmpty) {
return args2.where((e) => !e.isDynamic && !e.isObject).isEmpty;
} else if (args2.isEmpty) {
return args1.where((e) => !e.isDynamic && !e.isObject).isEmpty;
} else {
return _listEquivalencyTypeInfo.equals(args1, args2);
}
}