DeepCollectionEquality class Null safety

Deep equality on collections.

Recognizes lists, sets, iterables and maps and compares their elements using deep equality as well.

Non-iterable/map objects are compared using a configurable base equality.

Works in one of two modes: ordered or unordered.

In ordered mode, lists and iterables are required to have equal elements in the same order. In unordered mode, the order of elements in iterables and lists are not important.

A list is only equal to another list, likewise for sets and maps. All other iterables are compared as iterables only.

Implemented types

Constructors

DeepCollectionEquality([Equality base = const DefaultEquality<Never>()])
const
DeepCollectionEquality.unordered([Equality base = const DefaultEquality<Never>()])
Creates a deep equality on collections where the order of lists and iterables are not considered important. That is, lists and iterables are treated as unordered iterables.
const

Properties

hashCode int
The hash code for this object.
read-onlyinherited
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited

Methods

equals(dynamic e1, dynamic e2) bool
Compare two elements for being equal.
override
hash(Object? o) int
Creates a combined hash code for a number of objects.
override
isValidKey(Object? o) bool
Test whether an object is a valid argument to equals and hash.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited