equals method
override
Compare two elements for being equal.
This should be a proper equality relation.
Implementation
bool equals(e1, e2) {
if (e1 is Set) {
return e2 is Set && new SetEquality(this).equals(e1, e2);
}
if (e1 is Map) {
return e2 is Map &&
new MapEquality(keys: this, values: this).equals(e1, e2);
}
if (!_unordered) {
if (e1 is List) {
return e2 is List && new ListEquality(this).equals(e1, e2);
}
if (e1 is Iterable) {
return e2 is Iterable && new IterableEquality(this).equals(e1, e2);
}
} else if (e1 is Iterable) {
if (e1 is List != e2 is List) return false;
return e2 is Iterable &&
new UnorderedIterableEquality(this).equals(e1, e2);
}
return _base.equals(e1, e2);
}