rebuild method
T
rebuild(
- 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
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();
}