isAdjacentTo method Null safety

bool isAdjacentTo(
  1. PhoneNumber other
)

We consider the PhoneNumber to be adjacent to the this PhoneNumber if it is one less or one greater than this phone number.

Implementation

bool isAdjacentTo(PhoneNumber other) {
  return ((this + 1) == other) || ((this - 1) == other);
}