Fix non-proto3 JSON format double decoding (#1043) When the field type is a proto `float` or `double` we always use a Dart `double` for the value. Trying to set the field an `int` causes an assertion failure in `FieldSet`. This code is also a bit inconsistent in itself: when the jspblite2 value is a string it decodes as `double`, but when it's a number it tries to convert to an `int`. So if the value is a string `"1"` it stores as `double` but if it's the number `1` it tries to convert to double. This isn't an issue with dart2js as with dart2js `int` and `double` are the same thing, but it causes assertion failures when this library is used with dart2wasm which distinguishes `int`s and `double`s. Fix by always storing proto `float`s and `double`s as Dart `double`s. Note: this code is currently not used in dart2wasm, instead dart2wasm uses the VM's library. However if I start using this library instead (for benchmarking, to potentially switch to this library) then it breaks. So currently this change is not a user-visible change because dart2wasm doesn't use this library. cl/799924250
Protocol Buffers (protobuf) are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data.
This repository is home to packages related to protobuf support for Dart.
| Package | Description | Published Version |
|---|---|---|
| protobuf | Runtime library for protocol buffers support. | |
| protoc_plugin | A protobuf protoc compiler plugin used to generate Dart code. | |
| benchmarks | Benchmarks for various protobuf functions. |
For information about our publishing automation and release process, see https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.