label method

void label(
  1. Unit unit,
  2. String label
)

Attaches a system-wide label to the specified unit.

If the specified label is already associated to an unit the previous association is discarded or ignored.

Implementation

void label(Unit unit, String label) {
  if (!isValidIdentifier(label)) {
    throw ArgumentError('Label: $label is not a valid identifier.');
  }
  _nameToUnit[label] = unit;
  _unitToName[unit] = label;
}