isFraction property
bool
isFraction
Checks whether the String either:
- contains a valid representation of a fraction in the 'a/b' format;
- contains a fraction glyph character.
For example, this getter returns true
if this String is '1/4'
or
'⅝'
.
Implementation
bool get isFraction {
try {
Fraction.fromString(this);
return true;
} on Exception {
try {
Fraction.fromGlyph(this);
return true;
} on Exception {
return false;
}
}
}