-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate bytes
with Uint8List
#219
Comments
Can you be more specific? |
@sigmundch I updated the description to have current behavior and desired behavior. |
Just hit the same wall. |
@sigurdm Any traction on this? most of the ref: dart-lang/sdk#36900 |
Relatedly, we currently do not convert @$pb.TagNumber(15)
set optionalBytes($core.List<$core.int> v) {
$_setBytes(14, v);
} which calls protobuf.dart/protobuf/lib/src/protobuf/generated_message.dart Lines 456 to 457 in 14c9c0b
So the value is stored as protobuf.dart/protobuf/lib/src/protobuf/coded_buffer_writer.dart Lines 339 to 342 in 14c9c0b
I think the "ideal" solution would be to take That's a breaking change though and I'm not sure if we can afford it internally. So a close second could be keeping the API as-is, but storing the values as |
I just realized that this is not true, because protobuf.dart/protobuf/lib/src/protobuf/coded_buffer_writer.dart Lines 339 to 342 in 14c9c0b
We don't allocate a Another strange thing that I realized while reading the 4 lines shown above is that when we set a syntax = "proto3";
message M1 {
bytes b = 1;
} M1 m = M1();
m.b = <int>[99999];
print(m.b); // [99999]
print(m.writeToBuffer()); // [10, 1, 159] The reason why this is strange is because if I send this message to another program I would expect the local value for the message and the received message value to be the same, but if both the sender and the receiver use the Oh, and also, the JSON map and proto3 JSON serializers throw an exception when serializing this field.. So the library is also inconsistent in handling of such values. |
I understand that this could break someones code and is not backwards compatible, but I think having an |
Hi |
This is indeed a serious issue. |
Any progress? |
Ref: https://groups.google.com/a/dartlang.org/forum/#!topic/misc/JpNkRRLI9_w, daegalus/dart-uuid#35
More and more packages are explicitly switching to Uint8List
Right now, with the folling proto
The generated dart code (by
Activated protoc_plugin 16.0.1.
) isWe can see that we still have
Expected generated code:
One concern might be that this is more or less a breaking change in strong mode.
The text was updated successfully, but these errors were encountered: