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