OptionEq<A> class
Defines equality for instances of Option
.
The equality of two Option
instances depends on the equality of the values
they contain (if any). For this purpose, this class requires an instance of
Eq<A>
for the type of the values the Option
might hold.
final intEq = Eq.fromEquals((int x, int y) => x == y);
final optionEq = getEq(intEq);
expect(optionEq.equals(Some(1), Some(1)), true);
expect(optionEq.equals(Some(1), Some(2)), false);
expect(optionEq.equals(Some(1), None()), false);
expect(optionEq.equals(None(), None()), true);
Constructors
Properties
Methods
-
equals(
Option< A> x, Option<A> y) → bool -
Checks if
x
andy
are equal.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited