operator * method

Complex operator *(
  1. Object other
)

Multiplication

Implementation

Complex operator *(Object other) {
  if (other is Complex) {
    return Complex(
      real * other.real - imaginary * other.imaginary,
      real * other.imaginary + imaginary * other.real,
    );
  } else if (other is num) {
    return Complex(real * other, imaginary * other);
  }
  throw ArgumentError('Cannot multiply Complex by ${other.runtimeType}');
}