setExtension method

void setExtension(
  1. Extension extension,
  2. dynamic value
)

Sets the value of a non-repeated extension field to value.

Implementation

void setExtension(Extension extension, value) {
  if (value == null) throw ArgumentError('value is null');
  if (_isRepeated(extension.type)) {
    throw ArgumentError(_fieldSet._setFieldFailedMessage(
        extension, value, 'repeating field (use get + .add())'));
  }
  _fieldSet._ensureExtensions()._setFieldAndInfo(extension, value);
}