toBuilder method Null safety
Returns a writable, shallow copy of this message.
Sub messages will be shared with this
and will still be frozen if this
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
// TODO(nichite, sigurdm): Consider returning an actual builder object that
// lazily creates builders.
GeneratedMessage toBuilder() {
final result = createEmptyInstance();
result._fieldSet._shallowCopyValues(_fieldSet);
return result;
}