Generate code comments for annotated protobuf inputs. (#161)
Generate message constructor arguments by default again. New flag disable_constructor_args
disables generating the arguments.
Constructor arguments were removed in 21.0.0 as they increase dart2js binary sizes even when the arguments are not used.
Example usage to disable constructor arguments:
protoc --dart_out='disable_constructor_args,<other options>:.' ...
(Bad release, retracted)
Identifiers fromBuffer
, fromJson
, $_defaultFor
, initByValue
are no longer reserved. Proto fields with those Dart names will no longer have a suffix added. (#679)
Remove message constructor arguments. Constructors with arguments cause increase in release binary sizes even when no arguments are passed to the constructors. (#703)
Migration:
Set the fields after construction, using cascade syntax. For example, if you have:
MyMessage(a: 123, b: [1, 2, 3])
You can do:
MyMessage() ..a = 123 ..b.addAll([1, 2, 3])
Require Dart 2.19
.
Export public dependencies (import public
s in proto files) in .pbenum.dart
files, same as .pb.dart
files. (9aad6aa)
Fix decoding map fields when key or value (or both) fields of a map entry is missing. (#719, #745)
Generated files now split ignore_for_file
comments across multiple lines when necessary. (#770)
Generated files now uses shared consts to eliminate repeated bool.fromEnvironment()
expressions. (#772)
Removed accidental ///
at the top of generated Dart files to avoid new dangling_library_doc_comments
lint. (#774)
Generated files now have sorted imports and have fewer import-related ignore_for_file:
analysis directives. (#778)
Remove duplicated consts in generated files. (#773)
Emit depreciation of generated copyWith
and clone
methods.
Emit exports of GeneratedMessageGenericExtensions
from pb.dart
files.
Make protobuf enum names dependent on a fromEnvironment constant.
This will allow configuring the omission of the names in the final build.
If a target is built with dart_env = {"protobuf.omit_enum_names": "true"}
enum names will not be present in the compiled binary.
Make message and field names depend on fromEnvironment constants protobuf.omit_message_names
and protobuf.omit_field_names
respectively.
Omit type on a left hand side of generated static fields for extensions, which results in stricter type (Extension<ExtensionType>
instead of just Extension
).
Fix escaping of string default values.
annotate_overrides
in generated files.$
in descriptor's json_name
.Int64
and enum names beginning with digits after an initial underscore.protobuf
0.14.4. If protoc_plugin is installed in your path with pub global activate
you can upgrade with pub global activate protoc_plugin 19.0.0
ensureX
for each message field X.String
, int
, and bool
with usual default values.Fix mangling of extension names, message type names, and enum names that are Dart keywords.
Now you can have an extension called is
and an enum called class
.
bin/protoc-gen-dart.bat
script making it easier to compile on windows using a local checkout.Breaking: Generates code that requires at least protobuf
0.14.0.
Generate the non-camel-case name of fields when it cannot be derived from the json name.
Breaking: Use the correct proto3 Json CamelCase names for the string representation of field names (also for extensions), instead of using the name of the dart identifier for that field.
In most cases this name coincides with the name have emitted until now and require no change.
Exceptions are:
json_name
option.For any field with an updated name, this might require changes to uses of GeneratedMessage.getTagNumber(String FieldName)
, and calls to name-related methods of GeneratedMessage._info
.
GeneratedMessage.toString()
also uses the string representation. It will now print the json-name.
Well-known types (for now only google.protobuf.Any
and google.protobuf.Timestamp
) now uses a mixin to add special handling code instead of hardcoding it in the compiler.
GeneratedMessage.copyWith()
.argument_type_not_assignable
and return_of_invalid_type lint warnings
.DateTime
conversion methods to google.protobuf.Timestamp
.generate_kythe_info
option.*.pbgrpc.dart
files now import package:grpc/service_api.dart
instead of package:grpc/grpc.dart
. Generated code needs at least package:grpc 1.0.1.pbgrpc.dart
files now import package:grpc/grpc.dart
with a prefix.api_benchmark
. This simplifies the dev_dependencies of this package.createEmptyInstance
that is used to support the new toBuilder()
semantics of protobuf 0.11.0. The generated code requires at least protobuf 0.11.0.Breaking change: Handle identifiers starting with a leading underscore. This covers message names, enum names, enum value identifiers and file names.
Before, these would appear in the generated Dart code as private identifiers. Now the underscore is moved to the end.
Field names and extension field names already had all underscores removed, and these are not affected by this change.
If there is a conflicting name with a trailing underscore defined later in the same scope, a disambiguation will happen that can potentially lead to existing identifiers getting a new name in the generated Dart.
For example:
message _Foo {} message Foo_ {}
_Foo
will get the name Foo_
and Foo_
will now end up being called Foo__
.
Breaking change: Support for map fields Generated files require package:protobuf version 0.10.5 or newer. Protobuf map fields such as:
message Foo { map<int32, string> map_field = 1; } are now no longer represented as List<Foo_MapFieldEntry> but as Map<int, String>.
All code handling these fields needs to be updated.
Accidentally published as 11.0.0 instead of 0.11.0. Continuing from here.
dart:async
with a prefix to prevent name collisions.BuilderInfo.qualifiedMessageName
. Requires package:protobuf version 0.10.4 or newer.as
check of enum valueOf
by using correctly typed Map
of values. Generated files must require package:protobuf version 0.10.3 or newer.BuilderInfo.messageName
will now be the fully qualified name for generated messages.copyWith()
to message classes and update getDefault()
to use freeze()
. Requires package:protobuf version 0.10.0 or newer.pub global
usage. Protoc plugin can now be installed by running pub global activate protoc_plugin
.Function
will soon be a reserved keyword, so don't generate classes with that name.dart_name
option.This release requires 0.5.0 of the protobuf library.
This release changes how getters work for message fields, to detect a common mistake.
Previously, the protobuf API didn't report any error for an incorrect usage of setters. For example, if field “foo” is a message field of type Foo, this code would silently have no effect:
var msg = new SomeMessage(); msg.foo.bar = 123; This is because “msg.foo” would call “new Foo()” and return it without saving it.
The example can be fixed like this:
var msg = new SomeMessage(); msg.foo = new Foo(); msg.foo.bar = 123; Or equivalently:
var msg = new SomeMessage() ..foo = (new Foo()..bar = 123); Starting in 0.4.0, the default value of “msg.foo” is an immutable instance of Foo. You can read the default value of a field the same as before, but writes will throw UnsupportedError.
For now, new mixins can only be added using a patch:
This new API is subject to change without notice, but if you want to try it out anyway, see the unit test.
The 0.3.6 version of the dart-protobuf library added two new functions, so this release changes the protobuf compiler to avoid using them.
Protobuf changes for smaller dart2js code, Int64 fixes
This change is paired with https://chromiumcodereview.appspot.com/814213003
Reduces code size for one app by 0.9%
Parameterize uri resolution and parsing of options, use package:path.
This helps make the compiler more configurable to embed it in other systems (like pub transformers)
Update the version number