clamp method
Returns a Complex number whose real portion has been clamped to within lowerLimit
and
upperLimit
and whose imaginary portion is the same as the imaginary value in this Complex number.
Implementation
@override
Number clamp(dynamic lowerLimit, dynamic upperLimit) {
final clampedReal = real.clamp(lowerLimit, upperLimit) as Real;
if (clampedReal.toDouble() == 0) return imaginary.value.toDouble() == 0 ? Integer.zero : imaginary;
return Complex(clampedReal, imaginary);
}