isFraction property

bool isFraction

Checks whether the string contains a valid representation of a fraction in the format 'a/b'.

Note that 'a' and 'b' must be integers.

Implementation

bool get isFraction {
  try {
    Fraction.fromString(this);

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

      return true;
    } on FractionException {
      return false;
    }
  }
}