Use @dart = 2.7 in generated files (#455)
* Use @dart = 2.7 in genereted files
* More in changelog
* Fix goldens
* Fix lints
* Fix more lints
diff --git a/protobuf/lib/src/protobuf/field_set.dart b/protobuf/lib/src/protobuf/field_set.dart
index 368ca90..82511dc 100644
--- a/protobuf/lib/src/protobuf/field_set.dart
+++ b/protobuf/lib/src/protobuf/field_set.dart
@@ -103,12 +103,12 @@
static List _makeValueList(int length) {
if (length == 0) return _zeroList;
- return List(length);
+ return List.filled(length, null, growable: false);
}
// Use a fixed length list and not a constant list to ensure that _values
// always has the same implementation type.
- static final List _zeroList = List(0);
+ static final List _zeroList = [];
// Metadata about multiple fields
diff --git a/protoc_plugin/CHANGELOG.md b/protoc_plugin/CHANGELOG.md
index 51c9dab..0405d5f 100644
--- a/protoc_plugin/CHANGELOG.md
+++ b/protoc_plugin/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 19.3.0
+
+* Generate constructors with optional named arguments for prefilling fields.
+* Output language version 2.7 in generated files to support extension methods.
## 19.2.1
* Support optional proto3 fields.
diff --git a/protoc_plugin/lib/file_generator.dart b/protoc_plugin/lib/file_generator.dart
index f3fe706..f985c64 100644
--- a/protoc_plugin/lib/file_generator.dart
+++ b/protoc_plugin/lib/file_generator.dart
@@ -559,7 +559,7 @@
// Generated code. Do not modify.
// source: ${descriptor.name}
//
-// @dart = 2.3
+// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
''');
}
diff --git a/protoc_plugin/lib/names.dart b/protoc_plugin/lib/names.dart
index 2db6ce5..b93d79e 100644
--- a/protoc_plugin/lib/names.dart
+++ b/protoc_plugin/lib/names.dart
@@ -258,7 +258,7 @@
var existingNames = <String>{}..addAll(reservedMemberNames)..addAll(reserved);
- var fieldNames = List<FieldNames>(indexes.length);
+ var fieldNames = List<FieldNames>.filled(indexes.length, null);
void takeFieldNames(FieldNames chosen) {
fieldNames[chosen.index] = chosen;
diff --git a/protoc_plugin/lib/src/dart_options.pb.dart b/protoc_plugin/lib/src/dart_options.pb.dart
index 37712e1..4f1acc1 100644
--- a/protoc_plugin/lib/src/dart_options.pb.dart
+++ b/protoc_plugin/lib/src/dart_options.pb.dart
@@ -2,7 +2,7 @@
// Generated code. Do not modify.
// source: dart_options.proto
//
-// @dart = 2.3
+// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
import 'dart:core' as $core;
@@ -37,7 +37,23 @@
..hasRequiredFields = false;
DartMixin._() : super();
- factory DartMixin() => create();
+ factory DartMixin({
+ $core.String name,
+ $core.String importFrom,
+ $core.String parent,
+ }) {
+ final _result = create();
+ if (name != null) {
+ _result.name = name;
+ }
+ if (importFrom != null) {
+ _result.importFrom = importFrom;
+ }
+ if (parent != null) {
+ _result.parent = parent;
+ }
+ return _result;
+ }
factory DartMixin.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
@@ -121,7 +137,15 @@
..hasRequiredFields = false;
Imports._() : super();
- factory Imports() => create();
+ factory Imports({
+ $core.Iterable<DartMixin> mixins,
+ }) {
+ final _result = create();
+ if (mixins != null) {
+ _result.mixins.addAll(mixins);
+ }
+ return _result;
+ }
factory Imports.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
diff --git a/protoc_plugin/lib/src/descriptor.pb.dart b/protoc_plugin/lib/src/descriptor.pb.dart
index e5f71ac..b50be81 100644
--- a/protoc_plugin/lib/src/descriptor.pb.dart
+++ b/protoc_plugin/lib/src/descriptor.pb.dart
@@ -2,7 +2,7 @@
// Generated code. Do not modify.
// source: descriptor.proto
//
-// @dart = 2.3
+// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
import 'dart:core' as $core;
@@ -33,7 +33,15 @@
subBuilder: FileDescriptorProto.create);
FileDescriptorSet._() : super();
- factory FileDescriptorSet() => create();
+ factory FileDescriptorSet({
+ $core.Iterable<FileDescriptorProto> file,
+ }) {
+ final _result = create();
+ if (file != null) {
+ _result.file.addAll(file);
+ }
+ return _result;
+ }
factory FileDescriptorSet.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
@@ -101,7 +109,59 @@
..aOS(12, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'syntax');
FileDescriptorProto._() : super();
- factory FileDescriptorProto() => create();
+ factory FileDescriptorProto({
+ $core.String name,
+ $core.String package,
+ $core.Iterable<$core.String> dependency,
+ $core.Iterable<DescriptorProto> messageType,
+ $core.Iterable<EnumDescriptorProto> enumType,
+ $core.Iterable<ServiceDescriptorProto> service,
+ $core.Iterable<FieldDescriptorProto> extension,
+ FileOptions options,
+ SourceCodeInfo sourceCodeInfo,
+ $core.Iterable<$core.int> publicDependency,
+ $core.Iterable<$core.int> weakDependency,
+ $core.String syntax,
+ }) {
+ final _result = create();
+ if (name != null) {
+ _result.name = name;
+ }
+ if (package != null) {
+ _result.package = package;
+ }
+ if (dependency != null) {
+ _result.dependency.addAll(dependency);
+ }
+ if (messageType != null) {
+ _result.messageType.addAll(messageType);
+ }
+ if (enumType != null) {
+ _result.enumType.addAll(enumType);
+ }
+ if (service != null) {
+ _result.service.addAll(service);
+ }
+ if (extension != null) {
+ _result.extension.addAll(extension);
+ }
+ if (options != null) {
+ _result.options = options;
+ }
+ if (sourceCodeInfo != null) {
+ _result.sourceCodeInfo = sourceCodeInfo;
+ }
+ if (publicDependency != null) {
+ _result.publicDependency.addAll(publicDependency);
+ }
+ if (weakDependency != null) {
+ _result.weakDependency.addAll(weakDependency);
+ }
+ if (syntax != null) {
+ _result.syntax = syntax;
+ }
+ return _result;
+ }
factory FileDescriptorProto.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
@@ -242,7 +302,23 @@
subBuilder: ExtensionRangeOptions.create);
DescriptorProto_ExtensionRange._() : super();
- factory DescriptorProto_ExtensionRange() => create();
+ factory DescriptorProto_ExtensionRange({
+ $core.int start,
+ $core.int end,
+ ExtensionRangeOptions options,
+ }) {
+ final _result = create();
+ if (start != null) {
+ _result.start = start;
+ }
+ if (end != null) {
+ _result.end = end;
+ }
+ if (options != null) {
+ _result.options = options;
+ }
+ return _result;
+ }
factory DescriptorProto_ExtensionRange.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
@@ -337,7 +413,19 @@
..hasRequiredFields = false;
DescriptorProto_ReservedRange._() : super();
- factory DescriptorProto_ReservedRange() => create();
+ factory DescriptorProto_ReservedRange({
+ $core.int start,
+ $core.int end,
+ }) {
+ final _result = create();
+ if (start != null) {
+ _result.start = start;
+ }
+ if (end != null) {
+ _result.end = end;
+ }
+ return _result;
+ }
factory DescriptorProto_ReservedRange.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
@@ -422,7 +510,51 @@
..pPS(10, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'reservedName');
DescriptorProto._() : super();
- factory DescriptorProto() => create();
+ factory DescriptorProto({
+ $core.String name,
+ $core.Iterable<FieldDescriptorProto> field,
+ $core.Iterable<DescriptorProto> nestedType,
+ $core.Iterable<EnumDescriptorProto> enumType,
+ $core.Iterable<DescriptorProto_ExtensionRange> extensionRange,
+ $core.Iterable<FieldDescriptorProto> extension,
+ MessageOptions options,
+ $core.Iterable<OneofDescriptorProto> oneofDecl,
+ $core.Iterable<DescriptorProto_ReservedRange> reservedRange,
+ $core.Iterable<$core.String> reservedName,
+ }) {
+ final _result = create();
+ if (name != null) {
+ _result.name = name;
+ }
+ if (field != null) {
+ _result.field.addAll(field);
+ }
+ if (nestedType != null) {
+ _result.nestedType.addAll(nestedType);
+ }
+ if (enumType != null) {
+ _result.enumType.addAll(enumType);
+ }
+ if (extensionRange != null) {
+ _result.extensionRange.addAll(extensionRange);
+ }
+ if (extension != null) {
+ _result.extension.addAll(extension);
+ }
+ if (options != null) {
+ _result.options = options;
+ }
+ if (oneofDecl != null) {
+ _result.oneofDecl.addAll(oneofDecl);
+ }
+ if (reservedRange != null) {
+ _result.reservedRange.addAll(reservedRange);
+ }
+ if (reservedName != null) {
+ _result.reservedName.addAll(reservedName);
+ }
+ return _result;
+ }
factory DescriptorProto.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
@@ -521,7 +653,15 @@
..hasExtensions = true;
ExtensionRangeOptions._() : super();
- factory ExtensionRangeOptions() => create();
+ factory ExtensionRangeOptions({
+ $core.Iterable<UninterpretedOption> uninterpretedOption,
+ }) {
+ final _result = create();
+ if (uninterpretedOption != null) {
+ _result.uninterpretedOption.addAll(uninterpretedOption);
+ }
+ return _result;
+ }
factory ExtensionRangeOptions.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
@@ -596,7 +736,55 @@
..aOB(17, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'proto3Optional');
FieldDescriptorProto._() : super();
- factory FieldDescriptorProto() => create();
+ factory FieldDescriptorProto({
+ $core.String name,
+ $core.String extendee,
+ $core.int number,
+ FieldDescriptorProto_Label label,
+ FieldDescriptorProto_Type type,
+ $core.String typeName,
+ $core.String defaultValue,
+ FieldOptions options,
+ $core.int oneofIndex,
+ $core.String jsonName,
+ $core.bool proto3Optional,
+ }) {
+ final _result = create();
+ if (name != null) {
+ _result.name = name;
+ }
+ if (extendee != null) {
+ _result.extendee = extendee;
+ }
+ if (number != null) {
+ _result.number = number;
+ }
+ if (label != null) {
+ _result.label = label;
+ }
+ if (type != null) {
+ _result.type = type;
+ }
+ if (typeName != null) {
+ _result.typeName = typeName;
+ }
+ if (defaultValue != null) {
+ _result.defaultValue = defaultValue;
+ }
+ if (options != null) {
+ _result.options = options;
+ }
+ if (oneofIndex != null) {
+ _result.oneofIndex = oneofIndex;
+ }
+ if (jsonName != null) {
+ _result.jsonName = jsonName;
+ }
+ if (proto3Optional != null) {
+ _result.proto3Optional = proto3Optional;
+ }
+ return _result;
+ }
factory FieldDescriptorProto.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
@@ -783,7 +971,19 @@
subBuilder: OneofOptions.create);
OneofDescriptorProto._() : super();
- factory OneofDescriptorProto() => create();
+ factory OneofDescriptorProto({
+ $core.String name,
+ OneofOptions options,
+ }) {
+ final _result = create();
+ if (name != null) {
+ _result.name = name;
+ }
+ if (options != null) {
+ _result.options = options;
+ }
+ return _result;
+ }
factory OneofDescriptorProto.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
@@ -864,7 +1064,19 @@
..hasRequiredFields = false;
EnumDescriptorProto_EnumReservedRange._() : super();
- factory EnumDescriptorProto_EnumReservedRange() => create();
+ factory EnumDescriptorProto_EnumReservedRange({
+ $core.int start,
+ $core.int end,
+ }) {
+ final _result = create();
+ if (start != null) {
+ _result.start = start;
+ }
+ if (end != null) {
+ _result.end = end;
+ }
+ return _result;
+ }
factory EnumDescriptorProto_EnumReservedRange.fromBuffer(
$core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
@@ -948,7 +1160,31 @@
..pPS(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'reservedName');
EnumDescriptorProto._() : super();
- factory EnumDescriptorProto() => create();
+ factory EnumDescriptorProto({
+ $core.String name,
+ $core.Iterable<EnumValueDescriptorProto> value,
+ EnumOptions options,
+ $core.Iterable<EnumDescriptorProto_EnumReservedRange> reservedRange,
+ $core.Iterable<$core.String> reservedName,
+ }) {
+ final _result = create();
+ if (name != null) {
+ _result.name = name;
+ }
+ if (value != null) {
+ _result.value.addAll(value);
+ }
+ if (options != null) {
+ _result.options = options;
+ }
+ if (reservedRange != null) {
+ _result.reservedRange.addAll(reservedRange);
+ }
+ if (reservedName != null) {
+ _result.reservedName.addAll(reservedName);
+ }
+ return _result;
+ }
factory EnumDescriptorProto.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
@@ -1039,7 +1275,23 @@
subBuilder: EnumValueOptions.create);
EnumValueDescriptorProto._() : super();
- factory EnumValueDescriptorProto() => create();
+ factory EnumValueDescriptorProto({
+ $core.String name,
+ $core.int number,
+ EnumValueOptions options,
+ }) {
+ final _result = create();
+ if (name != null) {
+ _result.name = name;
+ }
+ if (number != null) {
+ _result.number = number;
+ }
+ if (options != null) {
+ _result.options = options;
+ }
+ return _result;
+ }
factory EnumValueDescriptorProto.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
@@ -1131,7 +1383,23 @@
subBuilder: ServiceOptions.create);
ServiceDescriptorProto._() : super();
- factory ServiceDescriptorProto() => create();
+ factory ServiceDescriptorProto({
+ $core.String name,
+ $core.Iterable<MethodDescriptorProto> method,
+ ServiceOptions options,
+ }) {
+ final _result = create();
+ if (name != null) {
+ _result.name = name;
+ }
+ if (method != null) {
+ _result.method.addAll(method);
+ }
+ if (options != null) {
+ _result.options = options;
+ }
+ return _result;
+ }
factory ServiceDescriptorProto.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
@@ -1223,7 +1491,35 @@
..aOB(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'serverStreaming');
MethodDescriptorProto._() : super();
- factory MethodDescriptorProto() => create();
+ factory MethodDescriptorProto({
+ $core.String name,
+ $core.String inputType,
+ $core.String outputType,
+ MethodOptions options,
+ $core.bool clientStreaming,
+ $core.bool serverStreaming,
+ }) {
+ final _result = create();
+ if (name != null) {
+ _result.name = name;
+ }
+ if (inputType != null) {
+ _result.inputType = inputType;
+ }
+ if (outputType != null) {
+ _result.outputType = outputType;
+ }
+ if (options != null) {
+ _result.options = options;
+ }
+ if (clientStreaming != null) {
+ _result.clientStreaming = clientStreaming;
+ }
+ if (serverStreaming != null) {
+ _result.serverStreaming = serverStreaming;
+ }
+ return _result;
+ }
factory MethodDescriptorProto.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
@@ -1378,7 +1674,97 @@
..hasExtensions = true;
FileOptions._() : super();
- factory FileOptions() => create();
+ factory FileOptions({
+ $core.String javaPackage,
+ $core.String javaOuterClassname,
+ FileOptions_OptimizeMode optimizeFor,
+ $core.bool javaMultipleFiles,
+ $core.String goPackage,
+ $core.bool ccGenericServices,
+ $core.bool javaGenericServices,
+ $core.bool pyGenericServices,
+ @$core.Deprecated('This field is deprecated.')
+ $core.bool javaGenerateEqualsAndHash,
+ $core.bool deprecated,
+ $core.bool javaStringCheckUtf8,
+ $core.bool ccEnableArenas,
+ $core.String objcClassPrefix,
+ $core.String csharpNamespace,
+ $core.String swiftPrefix,
+ $core.String phpClassPrefix,
+ $core.String phpNamespace,
+ $core.bool phpGenericServices,
+ $core.String phpMetadataNamespace,
+ $core.String rubyPackage,
+ $core.Iterable<UninterpretedOption> uninterpretedOption,
+ }) {
+ final _result = create();
+ if (javaPackage != null) {
+ _result.javaPackage = javaPackage;
+ }
+ if (javaOuterClassname != null) {
+ _result.javaOuterClassname = javaOuterClassname;
+ }
+ if (optimizeFor != null) {
+ _result.optimizeFor = optimizeFor;
+ }
+ if (javaMultipleFiles != null) {
+ _result.javaMultipleFiles = javaMultipleFiles;
+ }
+ if (goPackage != null) {
+ _result.goPackage = goPackage;
+ }
+ if (ccGenericServices != null) {
+ _result.ccGenericServices = ccGenericServices;
+ }
+ if (javaGenericServices != null) {
+ _result.javaGenericServices = javaGenericServices;
+ }
+ if (pyGenericServices != null) {
+ _result.pyGenericServices = pyGenericServices;
+ }
+ if (javaGenerateEqualsAndHash != null) {
+ // ignore: deprecated_member_use_from_same_package
+ _result.javaGenerateEqualsAndHash = javaGenerateEqualsAndHash;
+ }
+ if (deprecated != null) {
+ _result.deprecated = deprecated;
+ }
+ if (javaStringCheckUtf8 != null) {
+ _result.javaStringCheckUtf8 = javaStringCheckUtf8;
+ }
+ if (ccEnableArenas != null) {
+ _result.ccEnableArenas = ccEnableArenas;
+ }
+ if (objcClassPrefix != null) {
+ _result.objcClassPrefix = objcClassPrefix;
+ }
+ if (csharpNamespace != null) {
+ _result.csharpNamespace = csharpNamespace;
+ }
+ if (swiftPrefix != null) {
+ _result.swiftPrefix = swiftPrefix;
+ }
+ if (phpClassPrefix != null) {
+ _result.phpClassPrefix = phpClassPrefix;
+ }
+ if (phpNamespace != null) {
+ _result.phpNamespace = phpNamespace;
+ }
+ if (phpGenericServices != null) {
+ _result.phpGenericServices = phpGenericServices;
+ }
+ if (phpMetadataNamespace != null) {
+ _result.phpMetadataNamespace = phpMetadataNamespace;
+ }
+ if (rubyPackage != null) {
+ _result.rubyPackage = rubyPackage;
+ }
+ if (uninterpretedOption != null) {
+ _result.uninterpretedOption.addAll(uninterpretedOption);
+ }
+ return _result;
+ }
factory FileOptions.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
@@ -1684,7 +2070,31 @@
..hasExtensions = true;
MessageOptions._() : super();
- factory MessageOptions() => create();
+ factory MessageOptions({
+ $core.bool messageSetWireFormat,
+ $core.bool noStandardDescriptorAccessor,
+ $core.bool deprecated,
+ $core.bool mapEntry,
+ $core.Iterable<UninterpretedOption> uninterpretedOption,
+ }) {
+ final _result = create();
+ if (messageSetWireFormat != null) {
+ _result.messageSetWireFormat = messageSetWireFormat;
+ }
+ if (noStandardDescriptorAccessor != null) {
+ _result.noStandardDescriptorAccessor = noStandardDescriptorAccessor;
+ }
+ if (deprecated != null) {
+ _result.deprecated = deprecated;
+ }
+ if (mapEntry != null) {
+ _result.mapEntry = mapEntry;
+ }
+ if (uninterpretedOption != null) {
+ _result.uninterpretedOption.addAll(uninterpretedOption);
+ }
+ return _result;
+ }
factory MessageOptions.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
@@ -1793,7 +2203,39 @@
..hasExtensions = true;
FieldOptions._() : super();
- factory FieldOptions() => create();
+ factory FieldOptions({
+ FieldOptions_CType ctype,
+ $core.bool packed,
+ $core.bool deprecated,
+ $core.bool lazy,
+ FieldOptions_JSType jstype,
+ $core.bool weak,
+ $core.Iterable<UninterpretedOption> uninterpretedOption,
+ }) {
+ final _result = create();
+ if (ctype != null) {
+ _result.ctype = ctype;
+ }
+ if (packed != null) {
+ _result.packed = packed;
+ }
+ if (deprecated != null) {
+ _result.deprecated = deprecated;
+ }
+ if (lazy != null) {
+ _result.lazy = lazy;
+ }
+ if (jstype != null) {
+ _result.jstype = jstype;
+ }
+ if (weak != null) {
+ _result.weak = weak;
+ }
+ if (uninterpretedOption != null) {
+ _result.uninterpretedOption.addAll(uninterpretedOption);
+ }
+ return _result;
+ }
factory FieldOptions.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
@@ -1917,7 +2359,15 @@
..hasExtensions = true;
OneofOptions._() : super();
- factory OneofOptions() => create();
+ factory OneofOptions({
+ $core.Iterable<UninterpretedOption> uninterpretedOption,
+ }) {
+ final _result = create();
+ if (uninterpretedOption != null) {
+ _result.uninterpretedOption.addAll(uninterpretedOption);
+ }
+ return _result;
+ }
factory OneofOptions.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
@@ -1979,7 +2429,23 @@
..hasExtensions = true;
EnumOptions._() : super();
- factory EnumOptions() => create();
+ factory EnumOptions({
+ $core.bool allowAlias,
+ $core.bool deprecated,
+ $core.Iterable<UninterpretedOption> uninterpretedOption,
+ }) {
+ final _result = create();
+ if (allowAlias != null) {
+ _result.allowAlias = allowAlias;
+ }
+ if (deprecated != null) {
+ _result.deprecated = deprecated;
+ }
+ if (uninterpretedOption != null) {
+ _result.uninterpretedOption.addAll(uninterpretedOption);
+ }
+ return _result;
+ }
factory EnumOptions.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
@@ -2059,7 +2525,19 @@
..hasExtensions = true;
EnumValueOptions._() : super();
- factory EnumValueOptions() => create();
+ factory EnumValueOptions({
+ $core.bool deprecated,
+ $core.Iterable<UninterpretedOption> uninterpretedOption,
+ }) {
+ final _result = create();
+ if (deprecated != null) {
+ _result.deprecated = deprecated;
+ }
+ if (uninterpretedOption != null) {
+ _result.uninterpretedOption.addAll(uninterpretedOption);
+ }
+ return _result;
+ }
factory EnumValueOptions.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
@@ -2128,7 +2606,19 @@
..hasExtensions = true;
ServiceOptions._() : super();
- factory ServiceOptions() => create();
+ factory ServiceOptions({
+ $core.bool deprecated,
+ $core.Iterable<UninterpretedOption> uninterpretedOption,
+ }) {
+ final _result = create();
+ if (deprecated != null) {
+ _result.deprecated = deprecated;
+ }
+ if (uninterpretedOption != null) {
+ _result.uninterpretedOption.addAll(uninterpretedOption);
+ }
+ return _result;
+ }
factory ServiceOptions.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
@@ -2200,7 +2690,23 @@
..hasExtensions = true;
MethodOptions._() : super();
- factory MethodOptions() => create();
+ factory MethodOptions({
+ $core.bool deprecated,
+ MethodOptions_IdempotencyLevel idempotencyLevel,
+ $core.Iterable<UninterpretedOption> uninterpretedOption,
+ }) {
+ final _result = create();
+ if (deprecated != null) {
+ _result.deprecated = deprecated;
+ }
+ if (idempotencyLevel != null) {
+ _result.idempotencyLevel = idempotencyLevel;
+ }
+ if (uninterpretedOption != null) {
+ _result.uninterpretedOption.addAll(uninterpretedOption);
+ }
+ return _result;
+ }
factory MethodOptions.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
@@ -2279,7 +2785,19 @@
$pb.PbFieldType.QB);
UninterpretedOption_NamePart._() : super();
- factory UninterpretedOption_NamePart() => create();
+ factory UninterpretedOption_NamePart({
+ $core.String namePart,
+ $core.bool isExtension,
+ }) {
+ final _result = create();
+ if (namePart != null) {
+ _result.namePart = namePart;
+ }
+ if (isExtension != null) {
+ _result.isExtension = isExtension;
+ }
+ return _result;
+ }
factory UninterpretedOption_NamePart.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
@@ -2360,7 +2878,39 @@
..aOS(8, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'aggregateValue');
UninterpretedOption._() : super();
- factory UninterpretedOption() => create();
+ factory UninterpretedOption({
+ $core.Iterable<UninterpretedOption_NamePart> name,
+ $core.String identifierValue,
+ $fixnum.Int64 positiveIntValue,
+ $fixnum.Int64 negativeIntValue,
+ $core.double doubleValue,
+ $core.List<$core.int> stringValue,
+ $core.String aggregateValue,
+ }) {
+ final _result = create();
+ if (name != null) {
+ _result.name.addAll(name);
+ }
+ if (identifierValue != null) {
+ _result.identifierValue = identifierValue;
+ }
+ if (positiveIntValue != null) {
+ _result.positiveIntValue = positiveIntValue;
+ }
+ if (negativeIntValue != null) {
+ _result.negativeIntValue = negativeIntValue;
+ }
+ if (doubleValue != null) {
+ _result.doubleValue = doubleValue;
+ }
+ if (stringValue != null) {
+ _result.stringValue = stringValue;
+ }
+ if (aggregateValue != null) {
+ _result.aggregateValue = aggregateValue;
+ }
+ return _result;
+ }
factory UninterpretedOption.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
@@ -2493,7 +3043,31 @@
..hasRequiredFields = false;
SourceCodeInfo_Location._() : super();
- factory SourceCodeInfo_Location() => create();
+ factory SourceCodeInfo_Location({
+ $core.Iterable<$core.int> path,
+ $core.Iterable<$core.int> span,
+ $core.String leadingComments,
+ $core.String trailingComments,
+ $core.Iterable<$core.String> leadingDetachedComments,
+ }) {
+ final _result = create();
+ if (path != null) {
+ _result.path.addAll(path);
+ }
+ if (span != null) {
+ _result.span.addAll(span);
+ }
+ if (leadingComments != null) {
+ _result.leadingComments = leadingComments;
+ }
+ if (trailingComments != null) {
+ _result.trailingComments = trailingComments;
+ }
+ if (leadingDetachedComments != null) {
+ _result.leadingDetachedComments.addAll(leadingDetachedComments);
+ }
+ return _result;
+ }
factory SourceCodeInfo_Location.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
@@ -2577,7 +3151,15 @@
..hasRequiredFields = false;
SourceCodeInfo._() : super();
- factory SourceCodeInfo() => create();
+ factory SourceCodeInfo({
+ $core.Iterable<SourceCodeInfo_Location> location,
+ }) {
+ final _result = create();
+ if (location != null) {
+ _result.location.addAll(location);
+ }
+ return _result;
+ }
factory SourceCodeInfo.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
@@ -2638,7 +3220,27 @@
..hasRequiredFields = false;
GeneratedCodeInfo_Annotation._() : super();
- factory GeneratedCodeInfo_Annotation() => create();
+ factory GeneratedCodeInfo_Annotation({
+ $core.Iterable<$core.int> path,
+ $core.String sourceFile,
+ $core.int begin,
+ $core.int end,
+ }) {
+ final _result = create();
+ if (path != null) {
+ _result.path.addAll(path);
+ }
+ if (sourceFile != null) {
+ _result.sourceFile = sourceFile;
+ }
+ if (begin != null) {
+ _result.begin = begin;
+ }
+ if (end != null) {
+ _result.end = end;
+ }
+ return _result;
+ }
factory GeneratedCodeInfo_Annotation.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
@@ -2729,7 +3331,15 @@
..hasRequiredFields = false;
GeneratedCodeInfo._() : super();
- factory GeneratedCodeInfo() => create();
+ factory GeneratedCodeInfo({
+ $core.Iterable<GeneratedCodeInfo_Annotation> annotation,
+ }) {
+ final _result = create();
+ if (annotation != null) {
+ _result.annotation.addAll(annotation);
+ }
+ return _result;
+ }
factory GeneratedCodeInfo.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
diff --git a/protoc_plugin/lib/src/descriptor.pbenum.dart b/protoc_plugin/lib/src/descriptor.pbenum.dart
index 5dc79eb..e2d0c97 100644
--- a/protoc_plugin/lib/src/descriptor.pbenum.dart
+++ b/protoc_plugin/lib/src/descriptor.pbenum.dart
@@ -2,7 +2,7 @@
// Generated code. Do not modify.
// source: descriptor.proto
//
-// @dart = 2.3
+// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// ignore_for_file: UNDEFINED_SHOWN_NAME
diff --git a/protoc_plugin/lib/src/plugin.pb.dart b/protoc_plugin/lib/src/plugin.pb.dart
index a1c355e..f2ef929 100644
--- a/protoc_plugin/lib/src/plugin.pb.dart
+++ b/protoc_plugin/lib/src/plugin.pb.dart
@@ -2,7 +2,7 @@
// Generated code. Do not modify.
// source: plugin.proto
//
-// @dart = 2.3
+// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
import 'dart:core' as $core;
@@ -44,7 +44,27 @@
..hasRequiredFields = false;
Version._() : super();
- factory Version() => create();
+ factory Version({
+ $core.int major,
+ $core.int minor,
+ $core.int patch,
+ $core.String suffix,
+ }) {
+ final _result = create();
+ if (major != null) {
+ _result.major = major;
+ }
+ if (minor != null) {
+ _result.minor = minor;
+ }
+ if (patch != null) {
+ _result.patch = patch;
+ }
+ if (suffix != null) {
+ _result.suffix = suffix;
+ }
+ return _result;
+ }
factory Version.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
@@ -148,7 +168,27 @@
subBuilder: $0.FileDescriptorProto.create);
CodeGeneratorRequest._() : super();
- factory CodeGeneratorRequest() => create();
+ factory CodeGeneratorRequest({
+ $core.Iterable<$core.String> fileToGenerate,
+ $core.String parameter,
+ Version compilerVersion,
+ $core.Iterable<$0.FileDescriptorProto> protoFile,
+ }) {
+ final _result = create();
+ if (fileToGenerate != null) {
+ _result.fileToGenerate.addAll(fileToGenerate);
+ }
+ if (parameter != null) {
+ _result.parameter = parameter;
+ }
+ if (compilerVersion != null) {
+ _result.compilerVersion = compilerVersion;
+ }
+ if (protoFile != null) {
+ _result.protoFile.addAll(protoFile);
+ }
+ return _result;
+ }
factory CodeGeneratorRequest.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
@@ -241,7 +281,27 @@
..hasRequiredFields = false;
CodeGeneratorResponse_File._() : super();
- factory CodeGeneratorResponse_File() => create();
+ factory CodeGeneratorResponse_File({
+ $core.String name,
+ $core.String insertionPoint,
+ $core.String content,
+ $0.GeneratedCodeInfo generatedCodeInfo,
+ }) {
+ final _result = create();
+ if (name != null) {
+ _result.name = name;
+ }
+ if (insertionPoint != null) {
+ _result.insertionPoint = insertionPoint;
+ }
+ if (content != null) {
+ _result.content = content;
+ }
+ if (generatedCodeInfo != null) {
+ _result.generatedCodeInfo = generatedCodeInfo;
+ }
+ return _result;
+ }
factory CodeGeneratorResponse_File.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
@@ -347,7 +407,23 @@
..hasRequiredFields = false;
CodeGeneratorResponse._() : super();
- factory CodeGeneratorResponse() => create();
+ factory CodeGeneratorResponse({
+ $core.String error,
+ $fixnum.Int64 supportedFeatures,
+ $core.Iterable<CodeGeneratorResponse_File> file,
+ }) {
+ final _result = create();
+ if (error != null) {
+ _result.error = error;
+ }
+ if (supportedFeatures != null) {
+ _result.supportedFeatures = supportedFeatures;
+ }
+ if (file != null) {
+ _result.file.addAll(file);
+ }
+ return _result;
+ }
factory CodeGeneratorResponse.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
diff --git a/protoc_plugin/lib/src/plugin.pbenum.dart b/protoc_plugin/lib/src/plugin.pbenum.dart
index 11ee3a2..bdb52eb 100644
--- a/protoc_plugin/lib/src/plugin.pbenum.dart
+++ b/protoc_plugin/lib/src/plugin.pbenum.dart
@@ -2,7 +2,7 @@
// Generated code. Do not modify.
// source: plugin.proto
//
-// @dart = 2.3
+// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// ignore_for_file: UNDEFINED_SHOWN_NAME
diff --git a/protoc_plugin/pubspec.yaml b/protoc_plugin/pubspec.yaml
index f085ce7..49562ba 100644
--- a/protoc_plugin/pubspec.yaml
+++ b/protoc_plugin/pubspec.yaml
@@ -1,5 +1,5 @@
name: protoc_plugin
-version: 19.2.1
+version: 19.3.0
description: Protoc compiler plugin to generate Dart code
homepage: https://github.com/dart-lang/protobuf
diff --git a/protoc_plugin/test/generated_message_test.dart b/protoc_plugin/test/generated_message_test.dart
index 34359cb..b850b16 100755
--- a/protoc_plugin/test/generated_message_test.dart
+++ b/protoc_plugin/test/generated_message_test.dart
@@ -308,10 +308,7 @@
test('testReadHugeBlob', () {
// Allocate and initialize a 1MB blob.
- var blob = List<int>(1 << 20);
- for (var i = 0; i < blob.length; i++) {
- blob[i] = i % 256;
- }
+ var blob = List<int>.generate(1 << 20, (i) => i % 256);
// Make a message containing it.
var message = getAllSet();
diff --git a/protoc_plugin/test/goldens/grpc_service.pb b/protoc_plugin/test/goldens/grpc_service.pb
index 1e0e794..9f9b875 100644
--- a/protoc_plugin/test/goldens/grpc_service.pb
+++ b/protoc_plugin/test/goldens/grpc_service.pb
@@ -2,7 +2,7 @@
// Generated code. Do not modify.
// source: test
//
-// @dart = 2.3
+// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
import 'dart:core' as $core;
diff --git a/protoc_plugin/test/goldens/grpc_service.pbgrpc b/protoc_plugin/test/goldens/grpc_service.pbgrpc
index 6cb0095..34d1583 100644
--- a/protoc_plugin/test/goldens/grpc_service.pbgrpc
+++ b/protoc_plugin/test/goldens/grpc_service.pbgrpc
@@ -2,7 +2,7 @@
// Generated code. Do not modify.
// source: test
//
-// @dart = 2.3
+// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
import 'dart:async' as $async;
diff --git a/protoc_plugin/test/goldens/header_in_package.pb b/protoc_plugin/test/goldens/header_in_package.pb
index 93b7768..301c76a 100644
--- a/protoc_plugin/test/goldens/header_in_package.pb
+++ b/protoc_plugin/test/goldens/header_in_package.pb
@@ -2,7 +2,7 @@
// Generated code. Do not modify.
// source: test
//
-// @dart = 2.3
+// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
import 'dart:core' as $core;
diff --git a/protoc_plugin/test/goldens/header_with_fixnum.pb b/protoc_plugin/test/goldens/header_with_fixnum.pb
index ed21dac..1c65247 100644
--- a/protoc_plugin/test/goldens/header_with_fixnum.pb
+++ b/protoc_plugin/test/goldens/header_with_fixnum.pb
@@ -2,7 +2,7 @@
// Generated code. Do not modify.
// source: test
//
-// @dart = 2.3
+// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
import 'dart:core' as $core;
diff --git a/protoc_plugin/test/goldens/imports.pb b/protoc_plugin/test/goldens/imports.pb
index 3168eda..0db6fa8 100644
--- a/protoc_plugin/test/goldens/imports.pb
+++ b/protoc_plugin/test/goldens/imports.pb
@@ -2,7 +2,7 @@
// Generated code. Do not modify.
// source: test.proto
//
-// @dart = 2.3
+// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
import 'dart:core' as $core;
diff --git a/protoc_plugin/test/goldens/imports.pbjson b/protoc_plugin/test/goldens/imports.pbjson
index af2302f..2469b7e 100644
--- a/protoc_plugin/test/goldens/imports.pbjson
+++ b/protoc_plugin/test/goldens/imports.pbjson
@@ -2,6 +2,6 @@
// Generated code. Do not modify.
// source: test.proto
//
-// @dart = 2.3
+// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
diff --git a/protoc_plugin/test/goldens/int64.pb b/protoc_plugin/test/goldens/int64.pb
index ee98cb5..6b1d79d 100644
--- a/protoc_plugin/test/goldens/int64.pb
+++ b/protoc_plugin/test/goldens/int64.pb
@@ -2,7 +2,7 @@
// Generated code. Do not modify.
// source: test
//
-// @dart = 2.3
+// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
import 'dart:core' as $core;
diff --git a/protoc_plugin/test/goldens/oneMessage.pb b/protoc_plugin/test/goldens/oneMessage.pb
index 2a79ae9..54adfae 100644
--- a/protoc_plugin/test/goldens/oneMessage.pb
+++ b/protoc_plugin/test/goldens/oneMessage.pb
@@ -2,7 +2,7 @@
// Generated code. Do not modify.
// source: test
//
-// @dart = 2.3
+// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
import 'dart:core' as $core;
diff --git a/protoc_plugin/test/goldens/oneMessage.pbjson b/protoc_plugin/test/goldens/oneMessage.pbjson
index ec18d1d..0cac887 100644
--- a/protoc_plugin/test/goldens/oneMessage.pbjson
+++ b/protoc_plugin/test/goldens/oneMessage.pbjson
@@ -2,7 +2,7 @@
// Generated code. Do not modify.
// source: test
//
-// @dart = 2.3
+// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
const PhoneNumber$json = const {
diff --git a/protoc_plugin/test/goldens/service.pb b/protoc_plugin/test/goldens/service.pb
index ee31274..32d53ac 100644
--- a/protoc_plugin/test/goldens/service.pb
+++ b/protoc_plugin/test/goldens/service.pb
@@ -2,7 +2,7 @@
// Generated code. Do not modify.
// source: test
//
-// @dart = 2.3
+// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
import 'dart:async' as $async;
diff --git a/protoc_plugin/test/goldens/service.pbserver b/protoc_plugin/test/goldens/service.pbserver
index b776578..66d6e79 100644
--- a/protoc_plugin/test/goldens/service.pbserver
+++ b/protoc_plugin/test/goldens/service.pbserver
@@ -2,7 +2,7 @@
// Generated code. Do not modify.
// source: test
//
-// @dart = 2.3
+// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
import 'dart:async' as $async;
diff --git a/protoc_plugin/test/goldens/serviceGenerator.pb.json b/protoc_plugin/test/goldens/serviceGenerator.pb.json
index 7629c08..7a33efe 100644
--- a/protoc_plugin/test/goldens/serviceGenerator.pb.json
+++ b/protoc_plugin/test/goldens/serviceGenerator.pb.json
@@ -2,7 +2,7 @@
// Generated code. Do not modify.
// source: testpkg.proto
//
-// @dart = 2.3
+// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
import 'foobar.pbjson.dart' as $1;
diff --git a/protoc_plugin/test/goldens/topLevelEnum.pb b/protoc_plugin/test/goldens/topLevelEnum.pb
index bbbd5d5..d94d99f 100644
--- a/protoc_plugin/test/goldens/topLevelEnum.pb
+++ b/protoc_plugin/test/goldens/topLevelEnum.pb
@@ -2,7 +2,7 @@
// Generated code. Do not modify.
// source: test
//
-// @dart = 2.3
+// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
import 'dart:core' as $core;
diff --git a/protoc_plugin/test/goldens/topLevelEnum.pbenum b/protoc_plugin/test/goldens/topLevelEnum.pbenum
index 09840da..98f5b86 100644
--- a/protoc_plugin/test/goldens/topLevelEnum.pbenum
+++ b/protoc_plugin/test/goldens/topLevelEnum.pbenum
@@ -2,7 +2,7 @@
// Generated code. Do not modify.
// source: test
//
-// @dart = 2.3
+// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// ignore_for_file: UNDEFINED_SHOWN_NAME
diff --git a/protoc_plugin/test/goldens/topLevelEnum.pbjson b/protoc_plugin/test/goldens/topLevelEnum.pbjson
index 869bf1f..6a549fb 100644
--- a/protoc_plugin/test/goldens/topLevelEnum.pbjson
+++ b/protoc_plugin/test/goldens/topLevelEnum.pbjson
@@ -2,7 +2,7 @@
// Generated code. Do not modify.
// source: test
//
-// @dart = 2.3
+// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
const PhoneType$json = const {