operator == method

  1. @override
bool operator ==(
  1. Object obj
)
override

Two Numbers will be equal when the represented values are equal, even if the Number subtypes are different.

Implementation

@override
bool operator ==(Object obj) {
  if (obj is Imaginary) return value == obj.value;
  if (obj is Complex) return obj.real.value == 0.0 && this == obj.imaginary;
  if (obj is Real || obj is num) return value.toDouble() == 0.0 && obj == 0.0;

  return false;
}