representation property

  1. @override
String get representation
override

The representation of the value for display.

Implementation

@override
String get representation {
  return switch (rational.toString()) {
    '1' => '½',
    '1/2' => '⅓',
    '1/5' => '⅕',
    '1/6' => '⅙',
    '1/8' => '⅛',
    '2/3' => '⅔',
    '2/5' => '⅖',
    '5/6' => '⅚',
    '3/8' => '⅜',
    '3/4' => '¾',
    '3/5' => '⅗',
    '5/8' => '⅝',
    '7/8' => '⅞',
    '4/5' => '⅘',
    '1/4' => '¼',
    '1/7' => '⅐',
    '1/9' => '⅑',
    '1/10' => '⅒',
    _ => rational.toString()
  };
}