EqualityBy<E, F> class
Null safety
Equality of objects based on derived values.
For example, given the class:
abstract class Employee {
int get employmentId;
}
The following Equality considers employees with the same IDs to be equal:
EqualityBy((Employee e) => e.employmentId);
It's also possible to pass an additional equality instance that should be used to compare the value itself.
- Implemented types
-
- Equality<
E>
- Equality<
Constructors
-
EqualityBy(F comparisonKey(E), [Equality<
F> inner = const DefaultEquality<Never>()])
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(
E e1, E e2) → bool -
Compare two elements for being equal.
override
-
hash(
E e) → 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