isSameAs method

  1. @override
bool isSameAs(
  1. Object? other
)
override

Check Naked ID

Implementation

@override
bool isSameAs(Object? other) {
  ID? did  = ID.parse(other);
  if (did == null) {
    // should not happen
    return false;
  } else if (identical(did, this)) {
    // same object
    return true;
  }
  //
  //  1. check address
  //
  if (address != did.address) {
    // addresses not equal,
    // sure not the same entity
    return false;
  }
  //
  //  2. check name
  //
  String thisName = name ?? '';
  String thatName = did.name ?? '';
  return thisName == thatName;
}