equals method

bool equals(
  1. dynamic obj
)

Compares this object value to specified specified value. When direct comparison gives negative results it tries to compare values as strings.

  • obj the value to be compared with. Returns true when objects are equal and false otherwise.

Implementation

bool equals(obj) {
  if (obj == null && _value == null) return true;
  if (obj == null || _value == null) return false;

  if (obj is AnyValue) obj = obj._value;

  var strThisValue = StringConverter.toNullableString(_value);
  var strValue = StringConverter.toNullableString(obj);

  if (strThisValue == null && strValue == null) return true;
  if (strThisValue == null || strValue == null) return false;
  return strThisValue == strValue;
}