google / google/protobuf.dart

Should `PbList` and `PbMap` provide a `deepCopy` method?

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

Description

I realized while refactoring a use site that `PbMap` and `PbList` don't provide a `deepCopy` method and users have to implement their own deep copy functions.

For `PbList`, we provide a constructor `PbList.from(List from)` for shallow copy, but deep copying needs to be implemented by the user.

For `PbMap`, we don't provide a shallow constructor or a `deepCopy` method.

I think it might make sense to add:

- `PbMap.deepCopy`, `PbList.deepCopy`
- `PbMap` constructor for shallow copying, for consistency with `PbList`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.