addExtension method

void addExtension(
  1. Extension extension,
  2. dynamic value
)
inherited

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 ArgumentError(
        'Cannot add to a non-repeated field (use setExtension())');
  }
  _fieldSet._ensureExtensions()._ensureRepeatedField(extension).add(value);
}