How to tell Freezed or Equatable to utilize the == for IList?
As for now, Freezed use DeepCollectionEquality().equals which is very slow.
and Equatable use their custom code:
bool iterableEquals(Iterable<Object?> a, Iterable<Object?> b) {
assert(
a is! Set && b is! Set,
"iterableEquals doesn't support Sets. Use setEquals instead.",
);
if (identical(a, b)) return true;
if (a.length != b.length) return false;
for (var i = 0; i < a.length; i++) {
if (!objectsEquals(a.elementAt(i), b.elementAt(i))) return false;
}
return true;
}
bool objectsEquals(Object? a, Object? b) {
if (identical(a, b)) return true;
if (a is num && b is num) {
return numEquals(a, b);
} else if (_isEquatable(a) && _isEquatable(b)) {
return a == b;
} else if (a is Set && b is Set) {
return setEquals(a, b);
} else if (a is Iterable && b is Iterable) {
return iterableEquals(a, b);
} else if (a is Map && b is Map) {
return mapEquals(a, b);
} else if (a?.runtimeType != b?.runtimeType) {
return false;
} else if (a != b) {
return false;
}
return true;
}
How to tell Freezed or Equatable to utilize the == for IList?
As for now, Freezed use DeepCollectionEquality().equals which is very slow.
and Equatable use their custom code: