unitToString static method

String? unitToString(
  1. int unitTokenToFind
)

Return the unit token as its pretty name.

Implementation

static String? unitToString(int unitTokenToFind) {
  if (unitTokenToFind == TokenKind.PERCENT) {
    return '%';
  } else {
    for (final entry in _UNITS) {
      final unit = entry['unit'] as int;
      if (unit == unitTokenToFind) {
        return entry['value'] as String?;
      }
    }
  }

  return '<BAD UNIT>'; // Not a unit token.
}