setUnit method
Implementation
void setUnit(final String unitType, final String uid) {
checkNotClosed();
final String? previous = units_[unitType];
if ((previous != null) && !(previous == uid)) {
throw Exception("Unit $unitType already set.");
}
final String trimmed = uid.trim();
if (trimmed.isEmpty) {
throw Exception("Unit $unitType UID must not be blank.");
}
units_[unitType] = trimmed;
}