rebuild method
- @UseResult('[GeneratedMessageGenericExtensions.rebuild] ' 'does not update the message, returns a new message')
- void updates(
- T
Apply updates
to a copy of this message.
Throws an ArgumentError if this
is not already frozen.
Makes a writable shallow copy of this message, applies the updates
to
it, and marks the copy read-only before returning it.
Implementation
@UseResult('[GeneratedMessageGenericExtensions.rebuild] '
'does not update the message, returns a new message')
T rebuild(void Function(T) updates) {
if (!isFrozen) {
throw ArgumentError('Rebuilding only works on frozen messages.');
}
final t = toBuilder();
updates(t as T);
return t..freeze();
}