isMixedFraction property

bool isMixedFraction

Checks whether a string contains a valid representation of a mixed fraction in the 'a b/c' format:

  • 'a', 'b' and 'c' must be integers;
  • there can be the minus sign only in front of a;
  • there must be exactly one space between the whole part and the fraction.

Implementation

bool get isMixedFraction {
  try {
    MixedFraction.fromString(this);

    return true;
  } on Exception {
    return false;
  }
}