setUnit method

void setUnit(
  1. String unitType,
  2. String uid
)

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;
}