toBuilder method

GeneratedMessage toBuilder()

Creates a writable, shallow copy of this message.

Sub messages will be shared with this message and will still be frozen if this message is frozen.

The lists representing repeated fields are copied. But their elements will be shared with the corresponding list in this.

Similarly for map fields, the maps will be copied, but share the elements.

Implementation

GeneratedMessage toBuilder() {
  final result = createEmptyInstance();
  result._fieldSet._shallowCopyValues(_fieldSet);
  return result;
}