toStringAsFixed method
Prints the real and the imaginary parts of this Complex object with
fractionDigits
decimal digits. The output produced by this method is the
same that would result in calling toStringAsFixed
on a double:
final example = Complex(5.123, 8.123);
// Calling 'toStringAsFixed' on the `Complex` instance
print(example.toStringAsFixed(1)); // 5.1 + 8.1i
// The same result but with 'toStringAsFixed' calls on the single [double]
// values of the complex value
final real = example.real.toStringAsFixed(1);
final imag = example.imaginary.toStringAsFixed(1);
print("$real + $imag"); // 5.1 + 8.1i
Implementation
String toStringAsFixed(int fractionDigits) =>
_convertToString(fractionDigits: fractionDigits);