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