addExtension method

void addExtension(
  1. Extension extension,
  2. Object? 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.


void addExtension(Extension extension, Object? value) {
  if (!extension.isRepeated) {
    throw ArgumentError(
        'Cannot add to a non-repeated field (use setExtension())');