RationalCodec class
A codec for encoding and decoding Rational values to and from strings.
This class provides a single, canonical seam for Rational ↔ String
conversions at JSON/SQLite/persistence boundaries. It ensures consistent
formatting and centralizes parsing logic.
Example:
final encoded = RationalCodec.encode(Rational.fromInt(3, 4)); // "3/4"
final decoded = RationalCodec.decode("3/4"); // Rational(3, 4)
final safe = RationalCodec.tryDecode("invalid"); // null
Constructors
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