Use `$_createMessage()` of type `GeneratedMessage Function()` in Dart protoc compiler (#1093)

Often apps use extensive numbers of protos. The `BuilderInfo` of a proto will refer to sub proto messages via using `Foo.create` tear-offs.

Big apps can end up with tens of thousands of those `<name>.create` closures. All of them currently have a unique `<name> Function()` function type.

Though the actual usage of those closures is only in contexts where the caller of the closure expects a `GeneratedMessage` as return type. If a caller knew the actual return type, then the caller could call the constructor directly.

To avoid having to create potentially tens of thousands of unique function types, we make those closures have the
`GeneratedMessage Function()` type.

This mirrors cl/923994549  & cl/940364489
42 files changed
tree: 8612ca4446088cc61455bebd99891891c72e199f
  1. .github/
  2. benchmarks/
  3. protobuf/
  4. protoc_plugin/
  5. tool/
  6. .gitignore
  7. analysis_options.yaml
  8. AUTHORS
  9. LICENSE
  10. pubspec.yaml
  11. README.md
README.md

Protobuf support for Dart

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.

PackageDescriptionPublished Version
protobufRuntime library for protocol buffers support.pub package
protoc_pluginA protobuf protoc compiler plugin used to generate Dart code.pub package
benchmarksBenchmarks for various protobuf functions.

Publishing automation

For information about our publishing automation and release process, see https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.