operator == abstract method
- Object other
Checks whether other
has the same shape and equal fields to this record.
A record is only equal to another record with the same shape,
and then only when the value of every field is equal,
occording to its ==
, to the corresponding field value of other
.
There is no guaranteed order in which field value equality is checked, and it's unspecified whether further fields are checked after finding corresponding fields which are not equal. It's not even guaranteed that the order is consistent within a single program execution.
As usual, be very careful around objects which break the equality contract, like double.nan which is not equal to itself. For example
var pair = ("a", double.nan);
if (pair != pair) print("Oops");
will print the "Oops", because pair == pair
is defined to be equal to
"a" == "a" & double.nan == double.nan
, which is false.
Implementation
bool operator ==(Object other);