BaseUnit? getBaseUnit(String code) { for (final BaseUnit unit in baseUnits) { if (unit.code == code) { return unit; } } return null; }