google / google/protobuf.dart

PSA: the generated `clone()` and `copyWith()` methods are deprecated

Open
#998 0 comments 4 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
572
Forks
196
Avg merge
1h 59m
Merged PRs (30d)
2

Description

As a general PSA, the generated `MyMessage.clone()` and `MyMessage.copyWith(Function updates)` methods are deprecated. These methods can add significant overhead to your binary; we plan to remove in a future major version release of this package.

Instead of `MyMessage.clone()`, call `GeneratedMessageGenericExtensions.deepCopy()`.

Instead of `MyMessage.copyWith()`, call `GeneratedMessageGenericExtensions.rebuild()`.

We'll link to this issue from the generated source.

Contributor guide

Open the contributing guide

Research direction

Start by locating the generated source referenced in the issue and check how deprecations for MyMessage.clone() and MyMessage.copyWith(Function updates) are presented. Confirm whether the issue URL is linked there and whether the documented replacements, deepCopy() and rebuild(), are clear; done means the generated-source reference communicates the migration path.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.