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 a Uint8List
argument (instead of TypedData
).
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 another PbMap
.
To migrate, use PbMap.unmodifiable(map.keyFieldType, map.valueFieldType)
instead of PbMap.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.
Minimum SDK dependency bumped from 2.19.0 to 3.3.0. (#953)
CodedBufferReader
readBytes
now copies the returned bytes to avoid accidental sharing of the input buffer with the returned Uint8List
. New member readBytesAsView
added with the old behavior. (#863)
Avoid sharing the input buffer in unknown length-delimited fields using the new readBytes
. (#863)
2.19
.ReadonlyMessageMixin
(#183, #644)frozenMessageModificationHandler
(#175, #643)PbListBase
and FrozenPbList
types. All proto repeated fields now use PbList
. To check if a list is frozen, use isFrozen
getter. (#624, #626)GeneratedMessage.getField
. This behavior is consistent with getField
called on repeated fields. (#373, #707)PbMap
constructor argument BuilderInfo? info
. (d94d3f0)UnknownFieldSetField
methods hasRequiredFields
, isInitialized
and getter length
removed. (#721)PbMap._isReadonly
field initialization in PbMap.unmodifiable
. (#741, #754)mergeFromBuffer
, mergeFromProto3Json
, ...). (#489, #727)null
values in proto3 JSON deserializer. (#751, #760, #763)reparseMessage
. (#840)protobuf
and protoc_plugin
:Timestamp
to Dart DateTime
(#580, #577)BuilderInfo
and FieldInfo
properties (#597)BuilderInfo
initialization by doing some of the work lazily (#606)Any
messages from JSON (#568)repeated bytes
and optional bytes
fields. (#640)GeneratedMessage.rebuild
now generates a warning when the return value is not used. (#631)protobuf.omit_field_names
, enum value tags with protobuf.omit_enum_names
in debug strings (toString
methods) (#649)TimestampMixin.toDateTime
now takes an optional named bool
argument toLocal
(defaults to false
) for generating a DateTime
in the local time zone (instead of UTC). (#653)infinity
and nan
doubles in JSON serializers (#652)1.1.2
- 1.1.4
into v2.dart format
instead of dartfmt
.oneof
fields from proto3 json. The ‘whichFoo’ state would not be set.copyWith
.GeneratedMessage.rebuild
and GeneratedMessage.deepCopy
replacing copyWith
and clone
. Using these alternatives can result in smaller binaries, because it is defined once instead of once per class. Use protoc_plugin
from 19.1.0 to generate deprecation warnings for copyWith
and clone
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.timeout
to ClientContext
permissiveEnums
option to mergeFromProto3Json
. The comparison did not work properly.ExtensionRegistry.reparseMessage
not handling map fields with scalar value types correctly.protoName
) not being set correctly.permissiveEnums
option to mergeFromProto3Json
. It will do a case-insensitive matching of enum values ignoring -
and _
.protoc_plugin
19.0.0.String
, int
, and bool
with usual default values.getDefault()
.TagNumber
. This is used by code generated by protoc_plugin
from version 19.0.0.mapEntryBuilderInfo
in MapFieldInfo
.Support for import public
.
The generated code for a protofile a.proto
that import public "b.proto"
will export the generated code for b.proto
.
See https://developers.google.com/protocol-buffers/docs/proto#importing-definitions.
Support for proto3 json (json with field names as keys)
GeneratedMessage.toProto3Json()
to encode and GeneratedMessage.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, update protoc_plugin
to version 18.0.0 or higher.
The field-adder methods on BuilderInfo
all take a new argument protoName
.
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.
0.13.16
which accidentally introduced a breaking change, #284. This release is identical to 0.13.15
.BuilderInfo.add
with a tag number of 0. These would trigger assertions before.GeneratedMessage.isFrozen
to query if the message has been frozen.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._FieldSet.oneofCases
if the message contains oneofs.operator ==
and hashCode
in PbMap
so that two PbMap
s are equal if they have equal key/value pairs.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
and PbList.forFieldType
.
Fix issue with parsing map field entries. The values for two different keys would sometimes be merged.
Deprecated PBMap.add
.
Reading an unknown field set after freeze() now returns the existing field set before freezing instead of an empty UnknownFieldSet.
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 changed BuilderInfo.addMapField
as well as the constructors PbMap
and MapFieldInfo.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.
BuilderInfo.qualifiedMessageName
.ProtobufEnum.initByValue
which allows the return value to be fully typed.GeneratedMessage.freeze()
. A frozen message and its sub-messages cannot be changed.CodedBufferWriter.writeTo
to require Uint8List
for performance.Map
in PbMapMixin
pkg/crypto
for real.Require at least Dart SDK 1.13.
Removed dependency on pkg/crypto
.
fixnum
.setRange()
: Do not assume Iterable has a sublist()
method.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.