toFraction method

Fraction toFraction()

Converts this String into a Fraction.

If you want to be sure that this method doesn't throw an exception, use the isFraction getter before.

Implementation

Fraction toFraction() {
  try {
    return Fraction.fromString(this);
  } on FractionException {
    return Fraction.fromGlyph(this);
  }
}