setExtension method Null safety

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

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

Implementation

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