-
Breaking: The following types and members are now removed:
PbEventMixin
PbFieldChange
EventBuffer
GeneratedMessage.createRepeatedField
GeneratedMessage.createMapField
These were used to implement events, which are unused internally. To keep API surface small (to make it easier to change the library or migrate to another library) these types and members are removed. (#738)
-
Breaking:
CodedBufferWriter.writeRawBytes
now takes aUint8List
argument (instead ofTypedData
). -
GeneratedMessageGenericExtensions.deepCopy
is now annotated with@useResult
and will generate a warning when its result is not used. (#896) -
Breaking:
PbMap.unmodifiable
now takes key and value field types as arguments, instead of anotherPbMap
.To migrate, use
PbMap.unmodifiable(map.keyFieldType, map.valueFieldType)
instead ofPbMap.unmodifiable(map)
. (#902) -
Messages deserialized from JSON now generate the unknown fields when serialized as JSON.
Note that, as before, unknown fields in JSON messages are not stored in the
unknownFields
of the message. They are only used by the JSON serializers to support roundtripping.
-
CodedBufferReader
readBytes
now copies the returned bytes to avoid accidental sharing of the input buffer with the returnedUint8List
. New memberreadBytesAsView
added with the old behavior. (#863) -
Avoid sharing the input buffer in unknown length-delimited fields using the new
readBytes
. (#863)
- Require Dart
2.19
. - Remove
ReadonlyMessageMixin
(#183, #644) - Remove
frozenMessageModificationHandler
(#175, #643) - Remove
PbListBase
andFrozenPbList
types. All proto repeated fields now usePbList
. To check if a list is frozen, useisFrozen
getter. (#624, #626) - Initialize map fields in
GeneratedMessage.getField
. This behavior is consistent withgetField
called on repeated fields. (#373, #707) - Remove unused and optional
PbMap
constructor argumentBuilderInfo? info
. (d94d3f0) UnknownFieldSetField
methodshasRequiredFields
,isInitialized
and getterlength
removed. (#721)- Update library documentation to hide internals, add documentation for public types. (#681)
- Fix
PbMap._isReadonly
field initialization inPbMap.unmodifiable
. (#741, #754) - Fix decoding map fields when key or value (or both) fields of a map entry is missing. (#719, #745)
- Fix updating frozen (immutable) messages with merge methods
(
mergeFromBuffer
,mergeFromProto3Json
, ...). (#489, #727) - Fix handling
null
values in proto3 JSON deserializer. (#751, #760, #763) - Fix handling negative JSON values when parsing uint32 fields. (#839)
- Avoid serializing unknown fields twice in
reparseMessage
. (#840)
- Update READMEs of
protobuf
andprotoc_plugin
: - Update some of the documentation according to Effective Dart documentation guide (#664, #674)
- Improve runtime perf by removing some of the runtime type checks (#574, #573)
- Fix a bug when converting negative
Timestamp
to DartDateTime
(#580, #577) - Document
BuilderInfo
andFieldInfo
properties (#597) - Improve
BuilderInfo
initialization by doing some of the work lazily (#606) - Improve enum hash code generation (#556)
- Fix parsing nested
Any
messages from JSON (#568) - Improve message hash code generation performance (#554, #633)
- Fix reading uninitialized map fields changing equality and hash code of messages. (#638)
- Fix setting an extension field when there's an unknown field with the same tag. (#639)
- Fix sharing backing memory for
repeated bytes
andoptional bytes
fields. (#640) GeneratedMessage.rebuild
now generates a warning when the return value is not used. (#631)- Fix hash code of messages with empty unknown field set (#648)
- Show field tags with
protobuf.omit_field_names
, enum value tags withprotobuf.omit_enum_names
in debug strings (toString
methods) (#649) TimestampMixin.toDateTime
now takes an optional namedbool
argumenttoLocal
(defaults tofalse
) for generating aDateTime
in the local time zone (instead of UTC). (#653)- Fix serialization of
infinity
andnan
doubles in JSON serializers (#652) - Fix Dart generation for fields starting with underscore (#651)
- Fix proto3 JSON deserialization of fixed32 fields (#655)
- Fix uninitialized repeated field values runtime types for frozen messages (#654)
- Fix bug of parsing map-values with default values.
- Merge fixes from version
1.1.2
-1.1.4
into v2.
- Stable null safety release.
- Fix comparison of empty lists from frozen messages.
- Switch repo internals to use
dart format
instead ofdartfmt
.
- Fix that fixed32 int could be negative.
- Fix proto deserialization issue for repeated and map enum value fields where the enum value is unknown.
- Fix decoding of
oneof
fields from proto3 json. The 'whichFoo' state would not be set. - Fix the return type of
copyWith
.
- Require at least Dart SDK 2.7.0 to enable usage of extension methods.
- Introduce extension methods
GeneratedMessage.rebuild
andGeneratedMessage.deepCopy
replacingcopyWith
andclone
. Using these alternatives can result in smaller binaries, because it is defined once instead of once per class. Useprotoc_plugin
from 19.1.0 to generate deprecation warnings forcopyWith
andclone
methods. GeneratedMessage.getExtension
throws when reading trying to read an extension that is present in the unknown fields. We consider this change a bug-fix because depending on the old behavior is indicative of a bug in your program.
- Requires sdk 2.3.0
- Update pedantic to 1.9.2
- Enable hashCode memoization for frozen protos.
- Add
timeout
toClientContext
- Fix hashcode of bytes fields.
- Fix issue with the
permissiveEnums
option tomergeFromProto3Json
. The comparison did not work properly. - Fix binary representation of negative int32 values.
- Fix issue with
ExtensionRegistry.reparseMessage
not handling map fields with scalar value types correctly. - Fix issue with the non-json name of a field (
protoName
) not being set correctly. - Fix: Allow decoding tagnumbers of unknown fields of up to 29 bits.
- Graduate package to 1.0. No functional changes.
- Add
permissiveEnums
option tomergeFromProto3Json
. It will do a case-insensitive matching of enum values ignoring-
and_
. - Add support for 'ensureX' methods generated by
protoc_plugin
19.0.0. - Add specialized getters for
String
,int
, andbool
with usual default values. - Shrink dart2js generated code for
getDefault()
. - Added an annotation class
TagNumber
. This is used by code generated byprotoc_plugin
from version 19.0.0.
- Fix: Allow decoding tagnumbers of up to 29 bits. Would fail before with more than 28 bits.
- Expose
mapEntryBuilderInfo
inMapFieldInfo
.
-
Support for
import public
.The generated code for a protofile
a.proto
thatimport public "b.proto"
will export the generated code forb.proto
.See https://developers.google.com/protocol-buffers/docs/proto#importing-definitions.
-
Support for proto3 json (json with field names as keys)
- encoding and decoding.
- Support for well-known types.
- Use
GeneratedMessage.toProto3Json()
to encode andGeneratedMessage.mergeFromProto3Json(json)
to decode.
-
FieldInfo
objects have a new getter.protoName
that gives the non-camel-case name of the field as in the.proto
-file. -
Breaking: The field-adder methods on
BuilderInfo
now takes only named optional arguments. To migrate, updateprotoc_plugin
to version 18.0.0 or higher. -
The field-adder methods on
BuilderInfo
all take a new argumentprotoName
. -
Breaking: Changed
ExtensionRegistry.reparseMessage
to reparse extensions deeply, that is it looks at every nested message and tries to reparse extensions from its unknown fields.
- Reverts
0.13.16
which accidentally introduced a breaking change, #284. This release is identical to0.13.15
.
- Better handling of dummy calls to
BuilderInfo.add
with a tag number of 0. These would trigger assertions before.
- Add new getter
GeneratedMessage.isFrozen
to query if the message has been frozen.
- Avoid needless copy when reading from a Uint8List buffer.
Added
ExtensionRegistry.reparseMessage()` for decoding extensions from unknown fields after the initial decoding.
BuilderInfo.add
now ignores fields with tag number 0. These would never be generated by the protoc_plugin so this is not considered a breaking change.
- Save memory by only initializing
_FieldSet.oneofCases
if the message contains oneofs.
- Fix recursive merging of repeated elements.
- Move 'eventPlugin' callback when setting a field in order to notify observers about field updates in the correct order.
- Fix JSON serialization of unsigned 64-bit fields.
- Override
operator ==
andhashCode
inPbMap
so that twoPbMap
s are equal if they have equal key/value pairs.
- Fixed equality check between messages with and without extensions.
- Add new method
addAll
on ExtensionRegistry for more conveniently adding multiple extensions at once.
-
Add new method
pc
on BuilderInfo for adding repeated composite fields and remove redundant type check on items added to a PbList.Deprecated
BuilderInfo.pp
andPbList.forFieldType
.
-
Fix issue with parsing map field entries. The values for two different keys would sometimes be merged.
-
Deprecated
PBMap.add
.
- Include extension fields in GeneratedMessage.toString().
- Fix issue with not being able to read unknown fields after freezing.
Reading an unknown field set after freeze() now returns the existing field set before freezing instead of an empty UnknownFieldSet.
- Breaking change: Fix issue with not being able to read extensions after freezing.
Reading an extension field after freeze() now returns the value set before freezing instead of the default value.
-
Breaking change: Changed
BuilderInfo.m()
to take class and package name of the protobuf message representing the map entry. Also changedBuilderInfo.addMapField
as well as the constructorsPbMap
andMapFieldInfo.map
to take a map entry BuilderInfo object.This mostly affects generated code, which should now be built with protoc_plugin 15.0.0 or newer.
With this change we avoid creating a map entry BuilderInfo object for each PbMap instance, instead it is passed through the static BuilderInfo object in the generated subclasses of GeneratedMessage.
-
Breaking change: changed semantics of
GeneratedMessage.toBuilder()
to only make a shallow copy.GeneratedMessage
has a new abstract method:createEmptyInstance()
that subclasses must implement.Proto files must be rebuilt using protoc_plugin 14.0.0 or newer.
- Fix freezing of map fields.
- Fixed problem with recursive merging of sub messages.
- Added support for oneof. To use oneof support use Dart protoc_plugin version 13.0.0.
- Added support for map fields. Map fields are now represented as Dart maps and are accessed through a getter with the same name as the map field. To use the map support, use Dart protoc_plugin version 11.0.0 or newer.
- Added separate getter for
BuilderInfo.qualifiedMessageName
.
- Added type argument to
ProtobufEnum.initByValue
which allows the return value to be fully typed.
- Added ProtobufEnum reserved names.
- Added Support for any messages.
- Breaking change: Add
GeneratedMessage.freeze()
. A frozen message and its sub-messages cannot be changed.
- Fix problem with encoding negative enum values.
- Fix problem with encoding byte arrays.
- Dart SDK upper constraint raised to declare compatibility with Dart 2.0 stable.
- Breaking change: Changed signature of
CodedBufferWriter.writeTo
to requireUint8List
for performance. - More Dart 2 fixes.
- Breaking change: Added generics to RpcClient.invoke(). Proto files must be rebuilt using Dart protoc_plugin version 0.8.0 or newer to match.
- Dart 2 fixes.
- Updated SDK version to 2.0.0-dev.17.0
- Fix hashing for PbList.
- Fix type in PbList.fold() for Dart 2.
- Small performance tweaks for DDC.
- Added fast getters for common types.
- Only pass index instead of both tag and index to accessors.
- Delegate more methods to underlying list in PbList.
- Small fixes for Dart 2.0.
- Added enumValues to FieldInfo. Fixes #63.
- Small performance optimization when deserializing repeated messages from JSON.
- Type annotations for strong mode.
- Use real generic syntax instead of comment-based.
- Support v2 dev SDKs.
- Unknown enum values are ignored when parsing JSON, instead of throwing an exception.
- Resolved a strong-mode error.
- Performance: Avoid excessive cloning in merge.
- Performance: Use code patterns that dart2js handles better.
- fix zigzag function so all coded buffer reader tests work on dart2js.
- make PbMixin constructor public for use within protoc plugin.
- Revert previous change because it causes strong mode type error in the generated code. We will revisit this in a new version of mixin support.
- Use a more refined implementation of
Map
inPbMapMixin
- Performance: eliminate some dynamic calls.
- Bugfix: remove dependency on
pkg/crypto
for real.
-
Require at least Dart SDK 1.13.
-
Removed dependency on
pkg/crypto
.
- Experimental support for strong mode.
- Fixed an issue with GeneratedMessage operator== and Map mixins
- Added declaration of GeneratedMessage clone method
- Support the latest version of package
fixnum
.
- Reorganized internals to improve performance. We now store field values in a list instead of a map. Private properties and methods are all moved to the _FieldSet class. There are new entry points for generated getters, hazzers, and setters. Improved JSON decoding performance.
- Dropped compatibility with .pb.dart files before 0.4.2 by removing internal constants from GeneratedMessage. Also, protoc plugins before 0.5.0 won't work.
- Renamed FieldType to PbFieldType.
- added FieldType class. It turned out that FieldType is a commonly used name, even in .proto files. This is renamed to PbFieldType in 0.4.2.
- Added support for observing field changes. For now, this can only be enabled by using a mixin to override the eventPlugin getter.
- Removed optional third parameter from setField(). It was only intended for internal use, and could be used to defeat type checks on fields.
- clearExtension() removes the value and extension in all cases. (Before, the extension would be kept and the list cleared for repeated fields.)
- Upcoming: clearField() will require its argument to be a known tag number (which could be an extension). For now, this is only enforced when a mixin provides an eventPlugin.
- Add ReadonlyMessageMixin. The generated message classes use this to for the default values of message fields.
- Add meta.dart which declares reserved names for the plugin.
- Add GeneratedService and ProtobufClient interfaces.
- Add experimental mixins_meta library
- Add experimental PbMapMixin class (in a separate library).
- Fix bug where ExtensionRegistry would not be used for nested messages.
- More docs.
- Added mergeFromMap() and writeToJsonMap()
- Fixed an analyzer warning.
- Bugfix for
setRange()
: Do not assume Iterable has asublist()
method.
- Simplify some types used in is checks and correct PbList to match the
- signature of the List setRange method.
- Bugfix for incorrect decoding of protobuf messages: Uint8List views with non-zero offsets were handled incorrectly.
-
Allow constants as field initial values as well as creation thunks to reduce generated code size.
-
Improve the performance of reading a protobuf buffer.
-
Fixed truncation error in least significant bits with large Int64 constants.