RationalParsing class

A utility class for parsing strings into Rational objects with round-trip support. Unlike Rational.parse, which only handles integers, decimals, and scientific notation, this class can parse fractions (e.g., "7/4") produced by Rational.toString, ensuring compatibility with its output format as well as mixed fractions (e.g., "1 3/4").

Constructors

RationalParsing()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

fractionRegex RegExp
final

Static Methods

fromString(String value) → Rational
Parses a string into a Rational object, supporting fractions, mixed numbers, integers, decimals, and scientific notation.
tryFromString(String? value) → Rational?
Attempts to parse a string into a Rational object.