diff --git a/lib/src/list/built_list.dart b/lib/src/list/built_list.dart index 6dd8638..3cbf597 100644 --- a/lib/src/list/built_list.dart +++ b/lib/src/list/built_list.dart @@ -65,10 +65,7 @@ abstract class BuiltList implements Iterable, BuiltIterable { /// A `BuiltList` is only equal to another `BuiltList` with equal elements in /// the same order. Then, the `hashCode` is guaranteed to be the same. @override - int get hashCode { - _hashCode ??= hashObjects(_list); - return _hashCode!; - } + int get hashCode => _hashCode ??= hashObjects(_list); /// Deep equality. /// @@ -79,7 +76,11 @@ abstract class BuiltList implements Iterable, BuiltIterable { if (identical(other, this)) return true; if (other is! BuiltList) return false; if (other.length != length) return false; - if (other.hashCode != hashCode) return false; + if (_hashCode != null && + other._hashCode != null && + _hashCode != other._hashCode) { + return false; + } for (var i = 0; i != length; ++i) { if (other[i] != this[i]) return false; }