reduce method
Reduces this rational number to the lowest terms and returns the result in a new instance.
Implementation
@override
Fraction reduce() {
// Storing the sign for later use.
final sign = (numerator < 0) ? -1 : 1;
// Calculating the gcd for reduction.
final lgcd = numerator.gcd(denominator);
final num = (numerator * sign) ~/ lgcd;
final den = (denominator * sign) ~/ lgcd;
return Fraction(num, den);
}