getUnit method
Implementation
UcumUnit? getUnit(String code) {
for (final BaseUnit unit in baseUnits) {
if (unit.code == code) {
return unit;
}
}
for (final DefinedUnit unit in definedUnits) {
if (unit.code == code) {
return unit;
}
}
for (final BaseUnit unit in baseUnits) {
if (unit.names.contains(code)) {
return unit;
}
}
for (final DefinedUnit unit in definedUnits) {
if (unit.names.contains(code)) {
return unit;
}
}
return null;
}