toStringWithParenthesis method

String toStringWithParenthesis()

Prints the complex number with opening and closing parenthesis in case the complex number had both real and imaginary part.

Implementation

String toStringWithParenthesis() {
  if (real == 0) {
    return '${_fixZero(imaginary)}i';
  }

  if (imaginary == 0) {
    return _fixZero(real);
  }

  return '($this)';
}