getCanonicalUnits method

String getCanonicalUnits(
  1. String unit
)

Implementation

String getCanonicalUnits(String unit) {
  assert(checkStringParam(unit),
      paramError('getCanonicalUnits', 'unit', 'must not be null or empty'));
  try {
    final Term term = ExpressionParser(model).parse(unit);
    return ExpressionComposer()
        .composeCanonical(Converter(model, handlers).convert(term), false);
  } catch (e) {
    throw UcumException('Error processing $unit: $e');
  }
}