addExtension method

void addExtension (Extension extension, dynamic value)

Adds an extension field value to a repeated field.

The backing List will be created if necessary. If the list already exists, the old extension won't be overwritten.

Implementation

void addExtension(Extension extension, var value) {
  if (!extension.isRepeated) {
    throw new ArgumentError(
        'Cannot add to a non-repeated field (use setExtension())');
  }
  _fieldSet._ensureExtensions().._ensureRepeatedField(extension).add(value);
}