operator []= method

void operator []=(
  1. String? attributeName,
  2. dynamic rawValue
)
override

When we create these from strings or from AST nodes, we want to look up and set their attributes by string names, so we override the indexing operators so that they behave like maps with respect to those attribute names.

Implementation

void operator []=(String? attributeName, rawValue) {
  var value = Message.from(rawValue, this);
  if (validSelectKey.stringMatch(attributeName!) == attributeName) {
    cases[attributeName] = value;
  } else {
    throw new IntlMessageExtractionException(
        "Invalid select keyword: '$attributeName', must "
        "match '$selectPattern'");
  }
}