diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index d8b857716..82fcd681c 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -39,23 +39,23 @@ jobs: - name: mono_repo self validate run: dart pub global run mono_repo generate --validate job_002: - name: "format_analyze; linux; Dart 2.12.0; PKG: protobuf; `dart analyze lib`, `dart analyze test`" + name: "format_analyze; linux; Dart 2.19.0; PKG: protobuf; `dart analyze lib`, `dart analyze test`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.12.0;packages:protobuf;commands:analyze_1-analyze_2" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:protobuf;commands:analyze_1-analyze_2" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:2.12.0;packages:protobuf - os:ubuntu-latest;pub-cache-hosted;sdk:2.12.0 + os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:protobuf + os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0 os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f with: - sdk: "2.12.0" + sdk: "2.19.0" - id: checkout name: Checkout repository uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab @@ -233,23 +233,23 @@ jobs: if: "always() && steps.protoc_plugin_pub_upgrade.conclusion == 'success'" working-directory: protoc_plugin job_007: - name: "run_tests; linux; Dart 2.12.0; PKG: protobuf; `dart test`" + name: "run_tests; linux; Dart 2.19.0; PKG: protobuf; `dart test`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.12.0;packages:protobuf;commands:test_0" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:protobuf;commands:test_0" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:2.12.0;packages:protobuf - os:ubuntu-latest;pub-cache-hosted;sdk:2.12.0 + os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:protobuf + os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0 os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f with: - sdk: "2.12.0" + sdk: "2.19.0" - id: checkout name: Checkout repository uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab @@ -270,23 +270,23 @@ jobs: - job_005 - job_006 job_008: - name: "run_tests; linux; Dart 2.17.0; PKG: protoc_plugin; `./../tool/setup.sh`, `make protos`, `dart test`" + name: "run_tests; linux; Dart 2.19.0; PKG: protoc_plugin; `./../tool/setup.sh`, `make protos`, `dart test`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.17.0;packages:protoc_plugin;commands:command_0-command_3-test_0" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:protoc_plugin;commands:command_0-command_3-test_0" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:2.17.0;packages:protoc_plugin - os:ubuntu-latest;pub-cache-hosted;sdk:2.17.0 + os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:protoc_plugin + os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0 os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f with: - sdk: "2.17.0" + sdk: "2.19.0" - id: checkout name: Checkout repository uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab @@ -397,23 +397,23 @@ jobs: - job_005 - job_006 job_011: - name: "run_tests; osx; Dart 2.12.0; PKG: protobuf; `dart test`" + name: "run_tests; osx; Dart 2.19.0; PKG: protobuf; `dart test`" runs-on: macos-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 with: path: "~/.pub-cache/hosted" - key: "os:macos-latest;pub-cache-hosted;sdk:2.12.0;packages:protobuf;commands:test_0" + key: "os:macos-latest;pub-cache-hosted;sdk:2.19.0;packages:protobuf;commands:test_0" restore-keys: | - os:macos-latest;pub-cache-hosted;sdk:2.12.0;packages:protobuf - os:macos-latest;pub-cache-hosted;sdk:2.12.0 + os:macos-latest;pub-cache-hosted;sdk:2.19.0;packages:protobuf + os:macos-latest;pub-cache-hosted;sdk:2.19.0 os:macos-latest;pub-cache-hosted os:macos-latest - name: Setup Dart SDK uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f with: - sdk: "2.12.0" + sdk: "2.19.0" - id: checkout name: Checkout repository uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab @@ -471,13 +471,13 @@ jobs: - job_005 - job_006 job_013: - name: "run_tests; windows; Dart 2.12.0; PKG: protobuf; `dart test`" + name: "run_tests; windows; Dart 2.19.0; PKG: protobuf; `dart test`" runs-on: windows-latest steps: - name: Setup Dart SDK uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f with: - sdk: "2.12.0" + sdk: "2.19.0" - id: checkout name: Checkout repository uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab @@ -525,23 +525,23 @@ jobs: - job_005 - job_006 job_015: - name: "run_legacy_tests; linux; Dart 2.17.0; PKG: protoc_plugin; `./../tool/setup.sh`, `make protos`, `dart test legacy_tests/generated_message_test.dart`" + name: "run_legacy_tests; linux; Dart 2.19.0; PKG: protoc_plugin; `./../tool/setup.sh`, `make protos`, `dart test legacy_tests/generated_message_test.dart`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.17.0;packages:protoc_plugin;commands:command_0-command_3-test_1" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:protoc_plugin;commands:command_0-command_3-test_1" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:2.17.0;packages:protoc_plugin - os:ubuntu-latest;pub-cache-hosted;sdk:2.17.0 + os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:protoc_plugin + os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0 os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f with: - sdk: "2.17.0" + sdk: "2.19.0" - id: checkout name: Checkout repository uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab diff --git a/analysis_options.yaml b/analysis_options.yaml index 0411b3051..e7321a172 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,24 +1,16 @@ -include: package:lints/recommended.yaml +include: package:dart_flutter_team_lints/analysis_options.yaml analyzer: language: strict-casts: true + errors: + lines_longer_than_80_chars: ignore linter: rules: - - always_declare_return_types - avoid_bool_literals_in_conditional_expressions - - camel_case_types - comment_references - - directives_ordering - - no_leading_underscores_for_local_identifiers - - omit_local_variable_types - prefer_final_in_for_each - prefer_final_locals - prefer_relative_imports - - prefer_single_quotes - - prefer_spread_collections - - sort_pub_dependencies - - throw_in_finally - - type_annotate_public_apis - - unawaited_futures + - use_super_parameters diff --git a/api_benchmark/analysis_options.yaml b/api_benchmark/analysis_options.yaml index 06eee2aec..7e489e016 100644 --- a/api_benchmark/analysis_options.yaml +++ b/api_benchmark/analysis_options.yaml @@ -3,3 +3,5 @@ include: ../analysis_options.yaml analyzer: language: strict-casts: false + errors: + only_throw_errors: ignore diff --git a/api_benchmark/lib/benchmarks/get_strings.dart b/api_benchmark/lib/benchmarks/get_strings.dart index e1001ae72..ccf4531a4 100644 --- a/api_benchmark/lib/benchmarks/get_strings.dart +++ b/api_benchmark/lib/benchmarks/get_strings.dart @@ -4,7 +4,7 @@ import '../benchmark.dart'; import '../generated/benchmark.pb.dart' - show BenchmarkID, Request, Params, Sample; + show BenchmarkID, Params, Request, Sample; import '../generated/string_grid.pb.dart' as pb; /// A benchmark that accesses each value in a grid of string fields. diff --git a/api_benchmark/lib/benchmarks/has_strings.dart b/api_benchmark/lib/benchmarks/has_strings.dart index 2acea4f12..9301cc672 100644 --- a/api_benchmark/lib/benchmarks/has_strings.dart +++ b/api_benchmark/lib/benchmarks/has_strings.dart @@ -4,7 +4,7 @@ import '../benchmark.dart'; import '../generated/benchmark.pb.dart' - show BenchmarkID, Request, Params, Sample; + show BenchmarkID, Params, Request, Sample; import '../generated/string_grid.pb.dart' as pb; /// A benchmark that checks the existence of each item in a grid of strings. diff --git a/api_benchmark/lib/benchmarks/int32_json.dart b/api_benchmark/lib/benchmarks/int32_json.dart index 60889f49d..35deac0ee 100644 --- a/api_benchmark/lib/benchmarks/int32_json.dart +++ b/api_benchmark/lib/benchmarks/int32_json.dart @@ -4,7 +4,7 @@ import '../benchmark.dart'; import '../generated/benchmark.pb.dart' - show BenchmarkID, Request, Params, Sample; + show BenchmarkID, Params, Request, Sample; import '../generated/int32grid.pb.dart' as pb; /// A benchmark that deserializes a grid of int fields. diff --git a/api_benchmark/lib/benchmarks/int64_json.dart b/api_benchmark/lib/benchmarks/int64_json.dart index 4648c96ac..cc16f5244 100644 --- a/api_benchmark/lib/benchmarks/int64_json.dart +++ b/api_benchmark/lib/benchmarks/int64_json.dart @@ -6,7 +6,7 @@ import 'package:fixnum/fixnum.dart' show Int64; import '../benchmark.dart'; import '../generated/benchmark.pb.dart' - show BenchmarkID, Request, Params, Sample; + show BenchmarkID, Params, Request, Sample; import '../generated/int64grid.pb.dart' as pb; /// A benchmark that deserializes a grid of int fields. diff --git a/api_benchmark/lib/benchmarks/repeated_int32_json.dart b/api_benchmark/lib/benchmarks/repeated_int32_json.dart index 1747948f1..7f7ffbdb9 100644 --- a/api_benchmark/lib/benchmarks/repeated_int32_json.dart +++ b/api_benchmark/lib/benchmarks/repeated_int32_json.dart @@ -4,7 +4,7 @@ import '../benchmark.dart'; import '../generated/benchmark.pb.dart' - show BenchmarkID, Request, Params, Sample; + show BenchmarkID, Params, Request, Sample; import '../generated/int32grid.pb.dart' as pb; /// A benchmark that deserializes a grid of repeated ints. diff --git a/api_benchmark/lib/benchmarks/repeated_int64_json.dart b/api_benchmark/lib/benchmarks/repeated_int64_json.dart index da04e04a3..727ac5694 100644 --- a/api_benchmark/lib/benchmarks/repeated_int64_json.dart +++ b/api_benchmark/lib/benchmarks/repeated_int64_json.dart @@ -6,7 +6,7 @@ import 'package:fixnum/fixnum.dart'; import '../benchmark.dart'; import '../generated/benchmark.pb.dart' - show BenchmarkID, Request, Params, Sample; + show BenchmarkID, Params, Request, Sample; import '../generated/int64grid.pb.dart' as pb; /// A benchmark that deserializes a grid of repeated ints. diff --git a/api_benchmark/lib/benchmarks/repeated_string_json.dart b/api_benchmark/lib/benchmarks/repeated_string_json.dart index f99ba4e0f..24bc901c3 100644 --- a/api_benchmark/lib/benchmarks/repeated_string_json.dart +++ b/api_benchmark/lib/benchmarks/repeated_string_json.dart @@ -4,7 +4,7 @@ import '../benchmark.dart'; import '../generated/benchmark.pb.dart' - show BenchmarkID, Request, Params, Sample; + show BenchmarkID, Params, Request, Sample; import '../generated/string_grid.pb.dart' as pb; /// A benchmark that deserializes a grid of string fields. diff --git a/api_benchmark/lib/benchmarks/set_strings.dart b/api_benchmark/lib/benchmarks/set_strings.dart index 30e8f30a8..a10776b29 100644 --- a/api_benchmark/lib/benchmarks/set_strings.dart +++ b/api_benchmark/lib/benchmarks/set_strings.dart @@ -4,7 +4,7 @@ import '../benchmark.dart'; import '../generated/benchmark.pb.dart' - show BenchmarkID, Request, Params, Sample; + show BenchmarkID, Params, Request, Sample; import '../generated/string_grid.pb.dart' as pb; /// A benchmark that sets each value in a grid of string fields. diff --git a/api_benchmark/lib/benchmarks/string_json.dart b/api_benchmark/lib/benchmarks/string_json.dart index 4da01850c..5370c6a44 100644 --- a/api_benchmark/lib/benchmarks/string_json.dart +++ b/api_benchmark/lib/benchmarks/string_json.dart @@ -4,7 +4,7 @@ import '../benchmark.dart'; import '../generated/benchmark.pb.dart' - show BenchmarkID, Request, Params, Sample; + show BenchmarkID, Params, Request, Sample; import '../generated/string_grid.pb.dart' as pb; /// A benchmark that deserializes a grid of string fields. @@ -66,7 +66,7 @@ class StringBenchmark extends Benchmark { @override void run() { final grid = pb.Grid10.fromJson(json); - final actual = grid.lines[height - 1].getField(lastFieldTag!); + final actual = grid.lines[height - 1].getField(lastFieldTag!) as String; if (actual.length != stringSize) throw 'failed; got $actual'; } diff --git a/api_benchmark/lib/dashboard.dart b/api_benchmark/lib/dashboard.dart index c14015a81..395bd5c9e 100644 --- a/api_benchmark/lib/dashboard.dart +++ b/api_benchmark/lib/dashboard.dart @@ -5,14 +5,14 @@ import 'dart:async' show Future; import 'dart:convert'; import 'dart:html'; -import 'dart:js' show context, JsObject; +import 'dart:js' show JsObject, context; import 'benchmark.dart' show Profiler; -import 'dashboard_model.dart' show DashboardModel, Table, SelectEvent; +import 'dashboard_model.dart' show DashboardModel, SelectEvent, Table; import 'dashboard_view.dart' show DashboardView; import 'data_index.dart' as data; import 'generated/benchmark.pb.dart' as pb; -import 'report.dart' show createPlatform, createPackages; +import 'report.dart' show createPackages, createPlatform; import 'suite.dart' show runSuite; /// Displays a dashboard that can be used to run benchmarks. diff --git a/api_benchmark/lib/dashboard_model.dart b/api_benchmark/lib/dashboard_model.dart index f1d3b126a..b5efa65c3 100644 --- a/api_benchmark/lib/dashboard_model.dart +++ b/api_benchmark/lib/dashboard_model.dart @@ -41,7 +41,8 @@ class Table { Table._raw(suite, null, null, Set.from(suite.requests)); Table._raw(this.suite, this.baseline, this.report, this.selections) { - final it = report == null ? [].iterator : report!.responses.iterator; + final it = + report == null ? [].iterator : report!.responses.iterator; for (final r in suite.requests) { final b = createBenchmark(r); pb.Sample? baseline; diff --git a/api_benchmark/lib/dashboard_view.dart b/api_benchmark/lib/dashboard_view.dart index 4496e2580..5a8965963 100644 --- a/api_benchmark/lib/dashboard_view.dart +++ b/api_benchmark/lib/dashboard_view.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'dart:async' show Stream, StreamController, EventSink; +import 'dart:async' show EventSink, Stream, StreamController; import 'dart:html'; import 'dashboard_model.dart'; diff --git a/api_benchmark/lib/report.dart b/api_benchmark/lib/report.dart index df430b636..ab7f820a4 100644 --- a/api_benchmark/lib/report.dart +++ b/api_benchmark/lib/report.dart @@ -99,7 +99,7 @@ String encodeReport(pb.Report report) { } String _stringifyMap(StringBuffer out, Map json, String indent) { - final childIndent = indent + ' '; + final childIndent = '$indent '; out.writeln('{'); var first = true; for (final key in json.keys) { @@ -124,7 +124,7 @@ String _stringifyMap(StringBuffer out, Map json, String indent) { } void _stringifyList(StringBuffer out, List json, String indent) { - final childIndent = indent + ' '; + final childIndent = '$indent '; out.write('[\n'); var first = true; for (final item in json) { diff --git a/api_benchmark/lib/vm.dart b/api_benchmark/lib/vm.dart index ef7d57863..8b84a6fec 100644 --- a/api_benchmark/lib/vm.dart +++ b/api_benchmark/lib/vm.dart @@ -3,14 +3,14 @@ // BSD-style license that can be found in the LICENSE file. import 'dart:async' show Future; -import 'dart:io' show File, Directory, Link, Platform, stdout; +import 'dart:io' show Directory, File, Link, Platform, stdout; import 'benchmarks/index.dart' show createBenchmark; import 'data_index.dart' - show latestVMReportName, pubspecYamlName, pubspecLockName, hostfileName; + show hostfileName, latestVMReportName, pubspecLockName, pubspecYamlName; import 'generated/benchmark.pb.dart' as pb; import 'report.dart' - show createPlatform, createPackages, encodeReport, findUpdatedResponse; + show createPackages, createPlatform, encodeReport, findUpdatedResponse; import 'suite.dart' show runSuite; /// Runs a benchmark suite. @@ -68,8 +68,8 @@ Future _loadEnv() async { ..osType = _osType ..dartVersion = Platform.version; - final pubspec = await (File(pubspecYaml.path).readAsString()); - final lock = await (File(pubspecLock.path).readAsString()); + final pubspec = await File(pubspecYaml.path).readAsString(); + final lock = await File(pubspecLock.path).readAsString(); return pb.Env() ..script = _script diff --git a/api_benchmark/pubspec.yaml b/api_benchmark/pubspec.yaml index 1c00b6457..9a9d11ade 100644 --- a/api_benchmark/pubspec.yaml +++ b/api_benchmark/pubspec.yaml @@ -9,20 +9,21 @@ description: Benchmarking a number of different api calls. publish_to: none environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.19.0 <3.0.0' dependencies: + fixnum: any protobuf: any + yaml: ^3.0.0 dev_dependencies: build: ^2.0.0 build_runner: ^2.0.6 - build_web_compilers: ^3.0.0 + build_web_compilers: ^4.0.0 + dart_flutter_team_lints: ^1.0.0 glob: ^2.0.0 - lints: ^1.0.0 protoc_plugin: path: "../protoc_plugin" - yaml: ^3.0.0 dependency_overrides: protobuf: diff --git a/benchmarks/bin/deep_copy.dart b/benchmarks/bin/deep_copy.dart index 7c64d48c6..312bba9d4 100644 --- a/benchmarks/bin/deep_copy.dart +++ b/benchmarks/bin/deep_copy.dart @@ -16,12 +16,11 @@ class Benchmark extends BenchmarkBase { final p3.GoogleMessage1 _message1Proto3; final GoogleMessage2 _message2; - Benchmark(String name, List message1Proto2Input, + Benchmark(super.name, List message1Proto2Input, List message1Proto3Input, List message2Input) : _message1Proto2 = p2.GoogleMessage1.fromBuffer(message1Proto2Input), _message1Proto3 = p3.GoogleMessage1.fromBuffer(message1Proto3Input), - _message2 = GoogleMessage2.fromBuffer(message2Input), - super(name); + _message2 = GoogleMessage2.fromBuffer(message2Input); @override void run() { diff --git a/benchmarks/bin/from_binary.dart b/benchmarks/bin/from_binary.dart index 1d013830d..5f6630c7d 100644 --- a/benchmarks/bin/from_binary.dart +++ b/benchmarks/bin/from_binary.dart @@ -17,12 +17,11 @@ class Benchmark extends BenchmarkBase { final Uint8List _message1Proto3Input; final Uint8List _message2Input; - Benchmark(String name, List message1Proto2Input, + Benchmark(super.name, List message1Proto2Input, List message1Proto3Input, List message2Input) : _message1Proto2Input = Uint8List.fromList(message1Proto2Input), _message1Proto3Input = Uint8List.fromList(message1Proto3Input), - _message2Input = Uint8List.fromList(message2Input), - super(name); + _message2Input = Uint8List.fromList(message2Input); @override void run() { diff --git a/benchmarks/bin/from_json_string.dart b/benchmarks/bin/from_json_string.dart index 094878f76..9475617e4 100644 --- a/benchmarks/bin/from_json_string.dart +++ b/benchmarks/bin/from_json_string.dart @@ -15,15 +15,14 @@ class Benchmark extends BenchmarkBase { final String _message1Proto3JsonString; final String _message2JsonString; - Benchmark(String name, List message1Proto2Input, + Benchmark(super.name, List message1Proto2Input, List message1Proto3Input, List message2Input) : _message1Proto2JsonString = p2.GoogleMessage1.fromBuffer(message1Proto2Input).writeToJson(), _message1Proto3JsonString = p3.GoogleMessage1.fromBuffer(message1Proto3Input).writeToJson(), _message2JsonString = - GoogleMessage2.fromBuffer(message2Input).writeToJson(), - super(name); + GoogleMessage2.fromBuffer(message2Input).writeToJson(); @override void run() { diff --git a/benchmarks/bin/from_proto3_json_object.dart b/benchmarks/bin/from_proto3_json_object.dart index c7e9e7eda..fe67b00a4 100644 --- a/benchmarks/bin/from_proto3_json_object.dart +++ b/benchmarks/bin/from_proto3_json_object.dart @@ -15,15 +15,14 @@ class Benchmark extends BenchmarkBase { final Object? _message1Proto3Proto3JsonObject; final Object? _message2Proto3JsonObject; - Benchmark(String name, List message1Proto2Input, + Benchmark(super.name, List message1Proto2Input, List message1Proto3Input, List message2Input) : _message1Proto2Proto3JsonObject = p2.GoogleMessage1.fromBuffer(message1Proto2Input).toProto3Json(), _message1Proto3Proto3JsonObject = p3.GoogleMessage1.fromBuffer(message1Proto3Input).toProto3Json(), _message2Proto3JsonObject = - GoogleMessage2.fromBuffer(message2Input).toProto3Json(), - super(name); + GoogleMessage2.fromBuffer(message2Input).toProto3Json(); @override void run() { diff --git a/benchmarks/bin/from_proto3_json_string.dart b/benchmarks/bin/from_proto3_json_string.dart index 3a838d04b..1e6852186 100644 --- a/benchmarks/bin/from_proto3_json_string.dart +++ b/benchmarks/bin/from_proto3_json_string.dart @@ -17,15 +17,14 @@ class Benchmark extends BenchmarkBase { final String _message1Proto3Proto3JsonString; final String _message2Proto3JsonString; - Benchmark(String name, List message1Proto2Input, + Benchmark(super.name, List message1Proto2Input, List message1Proto3Input, List message2Input) : _message1Proto2Proto3JsonString = jsonEncode( p2.GoogleMessage1.fromBuffer(message1Proto2Input).toProto3Json()), _message1Proto3Proto3JsonString = jsonEncode( p3.GoogleMessage1.fromBuffer(message1Proto3Input).toProto3Json()), _message2Proto3JsonString = - jsonEncode(GoogleMessage2.fromBuffer(message2Input).toProto3Json()), - super(name); + jsonEncode(GoogleMessage2.fromBuffer(message2Input).toProto3Json()); @override void run() { diff --git a/benchmarks/bin/hash_code.dart b/benchmarks/bin/hash_code.dart index 894a0b4f8..c90c13166 100644 --- a/benchmarks/bin/hash_code.dart +++ b/benchmarks/bin/hash_code.dart @@ -15,12 +15,11 @@ class Benchmark extends BenchmarkBase { final p3.GoogleMessage1 _message1Proto3; final GoogleMessage2 _message2; - Benchmark(String name, List message1Proto2Input, + Benchmark(super.name, List message1Proto2Input, List message1Proto3Input, List message2Input) : _message1Proto2 = p2.GoogleMessage1.fromBuffer(message1Proto2Input), _message1Proto3 = p3.GoogleMessage1.fromBuffer(message1Proto3Input), - _message2 = GoogleMessage2.fromBuffer(message2Input), - super(name); + _message2 = GoogleMessage2.fromBuffer(message2Input); @override void run() { diff --git a/benchmarks/bin/query_decode_binary.dart b/benchmarks/bin/query_decode_binary.dart index ae5680ce9..eb7332d00 100644 --- a/benchmarks/bin/query_decode_binary.dart +++ b/benchmarks/bin/query_decode_binary.dart @@ -9,7 +9,7 @@ import 'package:protobuf_benchmarks/readfile.dart'; class Benchmark extends BenchmarkBase { final List _input; - Benchmark(String name, this._input) : super(name); + Benchmark(super.name, this._input); @override void run() { diff --git a/benchmarks/bin/query_decode_json.dart b/benchmarks/bin/query_decode_json.dart index 55cffd5f6..c66fbee49 100644 --- a/benchmarks/bin/query_decode_json.dart +++ b/benchmarks/bin/query_decode_json.dart @@ -9,9 +9,8 @@ import 'package:protobuf_benchmarks/readfile.dart'; class Benchmark extends BenchmarkBase { final String _input; - Benchmark(String name, List input) - : _input = f0.A0.fromBuffer(input).writeToJson(), - super(name); + Benchmark(super.name, List input) + : _input = f0.A0.fromBuffer(input).writeToJson(); @override void run() { diff --git a/benchmarks/bin/query_encode_binary.dart b/benchmarks/bin/query_encode_binary.dart index b54d48c9e..110febcfa 100644 --- a/benchmarks/bin/query_encode_binary.dart +++ b/benchmarks/bin/query_encode_binary.dart @@ -9,9 +9,7 @@ import 'package:protobuf_benchmarks/readfile.dart'; class Benchmark extends BenchmarkBase { final f0.A0 _input; - Benchmark(String name, List input) - : _input = f0.A0.fromBuffer(input), - super(name); + Benchmark(super.name, List input) : _input = f0.A0.fromBuffer(input); @override void run() { diff --git a/benchmarks/bin/query_encode_json.dart b/benchmarks/bin/query_encode_json.dart index 93b3a0622..7a4e97726 100644 --- a/benchmarks/bin/query_encode_json.dart +++ b/benchmarks/bin/query_encode_json.dart @@ -9,9 +9,7 @@ import 'package:protobuf_benchmarks/readfile.dart'; class Benchmark extends BenchmarkBase { final f0.A0 _input; - Benchmark(String name, List input) - : _input = f0.A0.fromBuffer(input), - super(name); + Benchmark(super.name, List input) : _input = f0.A0.fromBuffer(input); @override void run() { diff --git a/benchmarks/bin/query_set_nested_value.dart b/benchmarks/bin/query_set_nested_value.dart index 0af51ecfa..9b9adc335 100644 --- a/benchmarks/bin/query_set_nested_value.dart +++ b/benchmarks/bin/query_set_nested_value.dart @@ -12,9 +12,8 @@ import 'package:protobuf_benchmarks/readfile.dart'; class Benchmark extends BenchmarkBase { final f0.A0 _input; - Benchmark(String name, List input) - : _input = f0.A0.fromBuffer(input)..freeze(), - super(name); + Benchmark(super.name, List input) + : _input = f0.A0.fromBuffer(input)..freeze(); @override void run() { diff --git a/benchmarks/bin/to_binary.dart b/benchmarks/bin/to_binary.dart index ca272a816..e725f012f 100644 --- a/benchmarks/bin/to_binary.dart +++ b/benchmarks/bin/to_binary.dart @@ -15,12 +15,11 @@ class Benchmark extends BenchmarkBase { final p3.GoogleMessage1 _message1Proto3; final GoogleMessage2 _message2; - Benchmark(String name, List message1Proto2Input, + Benchmark(super.name, List message1Proto2Input, List message1Proto3Input, List message2Input) : _message1Proto2 = p2.GoogleMessage1.fromBuffer(message1Proto2Input), _message1Proto3 = p3.GoogleMessage1.fromBuffer(message1Proto3Input), - _message2 = GoogleMessage2.fromBuffer(message2Input), - super(name); + _message2 = GoogleMessage2.fromBuffer(message2Input); @override void run() { diff --git a/benchmarks/bin/to_json_string.dart b/benchmarks/bin/to_json_string.dart index df3784c79..2c482da17 100644 --- a/benchmarks/bin/to_json_string.dart +++ b/benchmarks/bin/to_json_string.dart @@ -15,12 +15,11 @@ class Benchmark extends BenchmarkBase { final p3.GoogleMessage1 _message1Proto3; final GoogleMessage2 _message2; - Benchmark(String name, List message1Proto2Input, + Benchmark(super.name, List message1Proto2Input, List message1Proto3Input, List message2Input) : _message1Proto2 = p2.GoogleMessage1.fromBuffer(message1Proto2Input), _message1Proto3 = p3.GoogleMessage1.fromBuffer(message1Proto3Input), - _message2 = GoogleMessage2.fromBuffer(message2Input), - super(name); + _message2 = GoogleMessage2.fromBuffer(message2Input); @override void run() { diff --git a/benchmarks/bin/to_proto3_json_object.dart b/benchmarks/bin/to_proto3_json_object.dart index d045a71dd..cb6ff6d43 100644 --- a/benchmarks/bin/to_proto3_json_object.dart +++ b/benchmarks/bin/to_proto3_json_object.dart @@ -15,12 +15,11 @@ class Benchmark extends BenchmarkBase { final p3.GoogleMessage1 _message1Proto3; final GoogleMessage2 _message2; - Benchmark(String name, List message1Proto2Input, + Benchmark(super.name, List message1Proto2Input, List message1Proto3Input, List message2Input) : _message1Proto2 = p2.GoogleMessage1.fromBuffer(message1Proto2Input), _message1Proto3 = p3.GoogleMessage1.fromBuffer(message1Proto3Input), - _message2 = GoogleMessage2.fromBuffer(message2Input), - super(name); + _message2 = GoogleMessage2.fromBuffer(message2Input); @override void run() { diff --git a/benchmarks/bin/to_proto3_json_string.dart b/benchmarks/bin/to_proto3_json_string.dart index 1215aa4e8..ac61e1390 100644 --- a/benchmarks/bin/to_proto3_json_string.dart +++ b/benchmarks/bin/to_proto3_json_string.dart @@ -17,12 +17,11 @@ class Benchmark extends BenchmarkBase { final p3.GoogleMessage1 _message1Proto3; final GoogleMessage2 _message2; - Benchmark(String name, List message1Proto2Input, + Benchmark(super.name, List message1Proto2Input, List message1Proto3Input, List message2Input) : _message1Proto2 = p2.GoogleMessage1.fromBuffer(message1Proto2Input), _message1Proto3 = p3.GoogleMessage1.fromBuffer(message1Proto3Input), - _message2 = GoogleMessage2.fromBuffer(message2Input), - super(name); + _message2 = GoogleMessage2.fromBuffer(message2Input); @override void run() { diff --git a/benchmarks/lib/benchmark_base.dart b/benchmarks/lib/benchmark_base.dart index cec44ccd5..ec9f060fa 100644 --- a/benchmarks/lib/benchmark_base.dart +++ b/benchmarks/lib/benchmark_base.dart @@ -16,7 +16,7 @@ import 'package:benchmark_harness/benchmark_harness.dart' as bh; /// what the benchmarks are about in Golem UI. /// abstract class BenchmarkBase extends bh.BenchmarkBase { - BenchmarkBase(String name) : super(name, emitter: const _ResultPrinter()); + BenchmarkBase(super.name) : super(emitter: const _ResultPrinter()); @override double measure() { diff --git a/benchmarks/pubspec.yaml b/benchmarks/pubspec.yaml index 7aa6f562c..68b002584 100644 --- a/benchmarks/pubspec.yaml +++ b/benchmarks/pubspec.yaml @@ -7,7 +7,7 @@ description: Benchmarks various protobuf functions publish_to: none environment: - sdk: '>=2.18.0 <3.0.0' + sdk: '>=2.19.0 <3.0.0' dependencies: # NB. When bumping benchmark_harness check if `benchmark_base.BenchmarkBase` @@ -19,7 +19,7 @@ dependencies: dev_dependencies: args: ^2.3.1 - lints: ^1.0.0 + dart_flutter_team_lints: ^1.0.0 path: ^1.8.2 pool: ^1.5.1 protoc_plugin: diff --git a/benchmarks/tool/compile_benchmarks.dart b/benchmarks/tool/compile_benchmarks.dart index 5bcc5d283..e22203284 100755 --- a/benchmarks/tool/compile_benchmarks.dart +++ b/benchmarks/tool/compile_benchmarks.dart @@ -1,6 +1,6 @@ #!/usr/bin/env dart -import 'dart:io' show exit, Platform, Process, Directory, ProcessResult; +import 'dart:io' show Directory, Platform, Process, ProcessResult, exit; import 'package:args/args.dart' show ArgParser; import 'package:path/path.dart' as path; diff --git a/protobuf/CHANGELOG.md b/protobuf/CHANGELOG.md index 223603344..49412301d 100644 --- a/protobuf/CHANGELOG.md +++ b/protobuf/CHANGELOG.md @@ -1,5 +1,6 @@ ## 3.0.0-dev +* Require Dart `2.19`. * Remove `ReadonlyMessageMixin` ([#183], [#644]) * Remove `frozenMessageModificationHandler` ([#175], [#643]) * Remove `PbListBase` and `FrozenPbList` types. All proto repeated fields now diff --git a/protobuf/lib/protobuf.dart b/protobuf/lib/protobuf.dart index b4d4ca996..5f73a14ed 100644 --- a/protobuf/lib/protobuf.dart +++ b/protobuf/lib/protobuf.dart @@ -5,13 +5,13 @@ /// Runtime library for Dart implementation of [protobufs][1]. /// /// [1]: https://developers.google.com/protocol-buffers -library protobuf; +library; import 'dart:collection' show ListBase, MapBase; import 'dart:convert' - show base64Decode, base64Encode, jsonEncode, jsonDecode, Utf8Codec; + show Utf8Codec, base64Decode, base64Encode, jsonDecode, jsonEncode; import 'dart:math' as math; -import 'dart:typed_data' show TypedData, Uint8List, ByteData, Endian; +import 'dart:typed_data' show ByteData, Endian, TypedData, Uint8List; import 'package:fixnum/fixnum.dart' show Int64; import 'package:meta/meta.dart' show UseResult; @@ -19,14 +19,15 @@ import 'package:meta/meta.dart' show UseResult; import 'src/protobuf/json_parsing_context.dart'; import 'src/protobuf/permissive_compare.dart'; import 'src/protobuf/type_registry.dart'; + export 'src/protobuf/type_registry.dart' show TypeRegistry; part 'src/protobuf/annotations.dart'; +part 'src/protobuf/builder_info.dart'; part 'src/protobuf/coded_buffer.dart'; part 'src/protobuf/coded_buffer_reader.dart'; part 'src/protobuf/coded_buffer_writer.dart'; part 'src/protobuf/consts.dart'; -part 'src/protobuf/builder_info.dart'; part 'src/protobuf/event_plugin.dart'; part 'src/protobuf/exceptions.dart'; part 'src/protobuf/extension.dart'; @@ -41,12 +42,12 @@ part 'src/protobuf/generated_service.dart'; part 'src/protobuf/json.dart'; part 'src/protobuf/pb_list.dart'; part 'src/protobuf/pb_map.dart'; -part 'src/protobuf/protobuf_enum.dart'; part 'src/protobuf/proto3_json.dart'; +part 'src/protobuf/protobuf_enum.dart'; part 'src/protobuf/rpc_client.dart'; part 'src/protobuf/unknown_field_set.dart'; -part 'src/protobuf/utils.dart'; part 'src/protobuf/unpack.dart'; +part 'src/protobuf/utils.dart'; part 'src/protobuf/wire_format.dart'; // TODO(sra): Use Int64.parse() when available - see http://dartbug.com/21915. diff --git a/protobuf/lib/src/protobuf/annotations.dart b/protobuf/lib/src/protobuf/annotations.dart index 193f434ae..9ec997b66 100644 --- a/protobuf/lib/src/protobuf/annotations.dart +++ b/protobuf/lib/src/protobuf/annotations.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -part of protobuf; +part of '../../protobuf.dart'; /// Annotation for marking accessors that belong together. class TagNumber { diff --git a/protobuf/lib/src/protobuf/builder_info.dart b/protobuf/lib/src/protobuf/builder_info.dart index c06cce5f3..53ea7b2ca 100644 --- a/protobuf/lib/src/protobuf/builder_info.dart +++ b/protobuf/lib/src/protobuf/builder_info.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -part of protobuf; +part of '../../protobuf.dart'; /// Per-message type setup. class BuilderInfo { diff --git a/protobuf/lib/src/protobuf/coded_buffer.dart b/protobuf/lib/src/protobuf/coded_buffer.dart index 5a4bbbbd9..382bf2093 100644 --- a/protobuf/lib/src/protobuf/coded_buffer.dart +++ b/protobuf/lib/src/protobuf/coded_buffer.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -part of protobuf; +part of '../../protobuf.dart'; void _writeToCodedBufferWriter(_FieldSet fs, CodedBufferWriter out) { // Sorting by tag number isn't required, but it sometimes enables @@ -196,7 +196,7 @@ void _mergeFromCodedBufferReader(BuilderInfo meta, _FieldSet fs, ._mergeEntry(mapEntryMeta, input, registry); break; default: - throw 'Unknown field type $fieldType'; + throw UnsupportedError('Unknown field type $fieldType'); } } } diff --git a/protobuf/lib/src/protobuf/coded_buffer_reader.dart b/protobuf/lib/src/protobuf/coded_buffer_reader.dart index 02730b07d..b3bb794d5 100644 --- a/protobuf/lib/src/protobuf/coded_buffer_reader.dart +++ b/protobuf/lib/src/protobuf/coded_buffer_reader.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -part of protobuf; +part of '../../protobuf.dart'; /// Reader used for converting binary-encoded protobufs into /// [GeneratedMessage]s. diff --git a/protobuf/lib/src/protobuf/coded_buffer_writer.dart b/protobuf/lib/src/protobuf/coded_buffer_writer.dart index bc306db70..6391584c3 100644 --- a/protobuf/lib/src/protobuf/coded_buffer_writer.dart +++ b/protobuf/lib/src/protobuf/coded_buffer_writer.dart @@ -4,7 +4,7 @@ // ignore_for_file: constant_identifier_names -part of protobuf; +part of '../../protobuf.dart'; /// Writer used for converting [GeneratedMessage]s into binary /// representation. @@ -338,10 +338,10 @@ class CodedBufferWriter { break; case PbFieldType._BYTES_BIT: _writeBytesNoTag( - value is TypedData ? value : Uint8List.fromList(value)); + value is Uint8List ? value : Uint8List.fromList(value)); break; case PbFieldType._STRING_BIT: - _writeBytesNoTag(_utf8.encode(value)); + _writeBytesNoTag(_utf8.encoder.convert(value)); break; case PbFieldType._DOUBLE_BIT: _writeDouble(value); @@ -355,6 +355,7 @@ class CodedBufferWriter { break; case PbFieldType._GROUP_BIT: // value is UnknownFieldSet or GeneratedMessage + // ignore: avoid_dynamic_calls value.writeToCodedBufferWriter(this); break; case PbFieldType._INT32_BIT: @@ -396,7 +397,7 @@ class CodedBufferWriter { } } - void _writeBytesNoTag(dynamic value) { + void _writeBytesNoTag(Uint8List value) { writeInt32NoTag(value.length); writeRawBytes(value); } diff --git a/protobuf/lib/src/protobuf/consts.dart b/protobuf/lib/src/protobuf/consts.dart index fb09aca0c..227188ac7 100644 --- a/protobuf/lib/src/protobuf/consts.dart +++ b/protobuf/lib/src/protobuf/consts.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -part of protobuf; +part of '../../protobuf.dart'; /// Constant string value of `double.infinity.toString()` and the infinity /// value recognized by `double.parse(..)`. diff --git a/protobuf/lib/src/protobuf/event_plugin.dart b/protobuf/lib/src/protobuf/event_plugin.dart index b4b701924..8e752d380 100644 --- a/protobuf/lib/src/protobuf/event_plugin.dart +++ b/protobuf/lib/src/protobuf/event_plugin.dart @@ -1,4 +1,4 @@ -part of protobuf; +part of '../../protobuf.dart'; /// An `EventPlugin` receives callbacks when the fields of a [GeneratedMessage] /// change. diff --git a/protobuf/lib/src/protobuf/exceptions.dart b/protobuf/lib/src/protobuf/exceptions.dart index 838dbe78c..ae629f5b7 100644 --- a/protobuf/lib/src/protobuf/exceptions.dart +++ b/protobuf/lib/src/protobuf/exceptions.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -part of protobuf; +part of '../../protobuf.dart'; const _truncatedMessageText = ''' While parsing a protocol message, the input ended unexpectedly diff --git a/protobuf/lib/src/protobuf/extension.dart b/protobuf/lib/src/protobuf/extension.dart index 3e037b004..d14950438 100644 --- a/protobuf/lib/src/protobuf/extension.dart +++ b/protobuf/lib/src/protobuf/extension.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -part of protobuf; +part of '../../protobuf.dart'; /// An object representing an extension field. class Extension extends FieldInfo { diff --git a/protobuf/lib/src/protobuf/extension_field_set.dart b/protobuf/lib/src/protobuf/extension_field_set.dart index bcdc61179..723390938 100644 --- a/protobuf/lib/src/protobuf/extension_field_set.dart +++ b/protobuf/lib/src/protobuf/extension_field_set.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -part of protobuf; +part of '../../protobuf.dart'; class _ExtensionFieldSet { final _FieldSet _parent; diff --git a/protobuf/lib/src/protobuf/extension_registry.dart b/protobuf/lib/src/protobuf/extension_registry.dart index 56ea0eeb5..71efe5f31 100644 --- a/protobuf/lib/src/protobuf/extension_registry.dart +++ b/protobuf/lib/src/protobuf/extension_registry.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -part of protobuf; +part of '../../protobuf.dart'; /// A collection of [Extension] objects, organized by the message type they /// extend. diff --git a/protobuf/lib/src/protobuf/field_error.dart b/protobuf/lib/src/protobuf/field_error.dart index a9ddaccd4..79e07c71c 100644 --- a/protobuf/lib/src/protobuf/field_error.dart +++ b/protobuf/lib/src/protobuf/field_error.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -part of protobuf; +part of '../../protobuf.dart'; /// Returns the error message for an invalid field value, /// or null if it's valid. diff --git a/protobuf/lib/src/protobuf/field_info.dart b/protobuf/lib/src/protobuf/field_info.dart index 939f5a580..070d5ea88 100644 --- a/protobuf/lib/src/protobuf/field_info.dart +++ b/protobuf/lib/src/protobuf/field_info.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -part of protobuf; +part of '../../protobuf.dart'; /// An object representing a protobuf message field. class FieldInfo { diff --git a/protobuf/lib/src/protobuf/field_set.dart b/protobuf/lib/src/protobuf/field_set.dart index f3e8b0608..fc3db2b5f 100644 --- a/protobuf/lib/src/protobuf/field_set.dart +++ b/protobuf/lib/src/protobuf/field_set.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -part of protobuf; +part of '../../protobuf.dart'; void _throwFrozenMessageModificationError(String messageName, [String? methodName]) { diff --git a/protobuf/lib/src/protobuf/field_type.dart b/protobuf/lib/src/protobuf/field_type.dart index ae9f3557a..cb6a1a47f 100644 --- a/protobuf/lib/src/protobuf/field_type.dart +++ b/protobuf/lib/src/protobuf/field_type.dart @@ -3,7 +3,7 @@ // BSD-style license that can be found in the LICENSE file. // ignore_for_file: constant_identifier_names,non_constant_identifier_names -part of protobuf; +part of '../../protobuf.dart'; bool _isRepeated(int fieldType) => (fieldType & PbFieldType._REPEATED_BIT) != 0; diff --git a/protobuf/lib/src/protobuf/generated_message.dart b/protobuf/lib/src/protobuf/generated_message.dart index aefcbd571..6da4bdfd7 100644 --- a/protobuf/lib/src/protobuf/generated_message.dart +++ b/protobuf/lib/src/protobuf/generated_message.dart @@ -4,7 +4,7 @@ // ignore_for_file: non_constant_identifier_names -part of protobuf; +part of '../../protobuf.dart'; /// Type of an empty message builder. typedef CreateBuilderFunc = GeneratedMessage Function(); diff --git a/protobuf/lib/src/protobuf/generated_service.dart b/protobuf/lib/src/protobuf/generated_service.dart index 13b5882fc..d3b3b0134 100644 --- a/protobuf/lib/src/protobuf/generated_service.dart +++ b/protobuf/lib/src/protobuf/generated_service.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -part of protobuf; +part of '../../protobuf.dart'; /// Server side context. class ServerContext { diff --git a/protobuf/lib/src/protobuf/json.dart b/protobuf/lib/src/protobuf/json.dart index 59cce92a7..98a522a92 100644 --- a/protobuf/lib/src/protobuf/json.dart +++ b/protobuf/lib/src/protobuf/json.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -part of protobuf; +part of '../../protobuf.dart'; Map _writeToJsonMap(_FieldSet fs) { dynamic convertToMap(dynamic fieldValue, int fieldType) { @@ -54,7 +54,7 @@ Map _writeToJsonMap(_FieldSet fs) { final GeneratedMessage msg = fieldValue; return msg.writeToJsonMap(); default: - throw 'Unknown type $fieldType'; + throw UnsupportedError('Unknown type $fieldType'); } } diff --git a/protobuf/lib/src/protobuf/mixins/event_mixin.dart b/protobuf/lib/src/protobuf/mixins/event_mixin.dart index b7ca0da6e..b402242c6 100644 --- a/protobuf/lib/src/protobuf/mixins/event_mixin.dart +++ b/protobuf/lib/src/protobuf/mixins/event_mixin.dart @@ -5,7 +5,7 @@ import 'dart:async' show StreamController, scheduleMicrotask; import 'dart:collection' show UnmodifiableListView; -import '../../../protobuf.dart' show GeneratedMessage, FieldInfo, EventPlugin; +import '../../../protobuf.dart' show EventPlugin, FieldInfo, GeneratedMessage; /// Provides a stream of changes to fields in a [GeneratedMessage]. /// (Experimental.) diff --git a/protobuf/lib/src/protobuf/pb_list.dart b/protobuf/lib/src/protobuf/pb_list.dart index 378f83cf9..045d5f855 100644 --- a/protobuf/lib/src/protobuf/pb_list.dart +++ b/protobuf/lib/src/protobuf/pb_list.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -part of protobuf; +part of '../../protobuf.dart'; /// Type of a function that checks items added to a `PbList`. /// diff --git a/protobuf/lib/src/protobuf/pb_map.dart b/protobuf/lib/src/protobuf/pb_map.dart index 773b3451d..c8f6ef731 100644 --- a/protobuf/lib/src/protobuf/pb_map.dart +++ b/protobuf/lib/src/protobuf/pb_map.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -part of protobuf; +part of '../../protobuf.dart'; /// A [MapBase] implementation used for protobuf `map` fields. class PbMap extends MapBase { diff --git a/protobuf/lib/src/protobuf/proto3_json.dart b/protobuf/lib/src/protobuf/proto3_json.dart index 2ad77efd4..c40806d4a 100644 --- a/protobuf/lib/src/protobuf/proto3_json.dart +++ b/protobuf/lib/src/protobuf/proto3_json.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -part of protobuf; +part of '../../protobuf.dart'; Object? _writeToProto3Json(_FieldSet fs, TypeRegistry typeRegistry) { String? convertToMapKey(dynamic key, int keyType) { @@ -67,8 +67,8 @@ Object? _writeToProto3Json(_FieldSet fs, TypeRegistry typeRegistry) { if (value.isInfinite) { return value.isNegative ? _negativeInfinity : _infinity; } - if (fieldValue.toInt() == fieldValue) { - return fieldValue.toInt(); + if (value.toInt() == fieldValue) { + return value.toInt(); } return value; case PbFieldType._UINT64_BIT: diff --git a/protobuf/lib/src/protobuf/protobuf_enum.dart b/protobuf/lib/src/protobuf/protobuf_enum.dart index 7f5b7e263..b96c119a4 100644 --- a/protobuf/lib/src/protobuf/protobuf_enum.dart +++ b/protobuf/lib/src/protobuf/protobuf_enum.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -part of protobuf; +part of '../../protobuf.dart'; /// A base class for all proto enum types. /// diff --git a/protobuf/lib/src/protobuf/rpc_client.dart b/protobuf/lib/src/protobuf/rpc_client.dart index 9c5f24418..776eb01d1 100644 --- a/protobuf/lib/src/protobuf/rpc_client.dart +++ b/protobuf/lib/src/protobuf/rpc_client.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -part of protobuf; +part of '../../protobuf.dart'; /// Client side context for [RpcClient]s. class ClientContext { diff --git a/protobuf/lib/src/protobuf/unknown_field_set.dart b/protobuf/lib/src/protobuf/unknown_field_set.dart index d633ee12f..556897e56 100644 --- a/protobuf/lib/src/protobuf/unknown_field_set.dart +++ b/protobuf/lib/src/protobuf/unknown_field_set.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -part of protobuf; +part of '../../protobuf.dart'; /// A set of unknown fields in a [GeneratedMessage]. class UnknownFieldSet { @@ -132,7 +132,7 @@ class UnknownFieldSet { UnknownFieldSetField _getField(int number) { _checkFieldNumber(number); if (_isReadOnly) assert(_fields.containsKey(number)); - return _fields.putIfAbsent(number, () => UnknownFieldSetField()); + return _fields.putIfAbsent(number, UnknownFieldSetField.new); } @override diff --git a/protobuf/lib/src/protobuf/unpack.dart b/protobuf/lib/src/protobuf/unpack.dart index a49ff7805..14a27260e 100644 --- a/protobuf/lib/src/protobuf/unpack.dart +++ b/protobuf/lib/src/protobuf/unpack.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -part of protobuf; +part of '../../protobuf.dart'; /// Unpacks the message in [value] into [instance]. /// diff --git a/protobuf/lib/src/protobuf/utils.dart b/protobuf/lib/src/protobuf/utils.dart index 830e73df3..6e4df1da1 100644 --- a/protobuf/lib/src/protobuf/utils.dart +++ b/protobuf/lib/src/protobuf/utils.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -part of protobuf; +part of '../../protobuf.dart'; // TODO(antonm): reconsider later if PbList should take care of equality. bool _deepEquals(lhs, rhs) { diff --git a/protobuf/lib/src/protobuf/wire_format.dart b/protobuf/lib/src/protobuf/wire_format.dart index b4784d244..a255c8176 100644 --- a/protobuf/lib/src/protobuf/wire_format.dart +++ b/protobuf/lib/src/protobuf/wire_format.dart @@ -4,7 +4,7 @@ // ignore_for_file: constant_identifier_names -part of protobuf; +part of '../../protobuf.dart'; const int _TAG_TYPE_BITS = 3; const int _TAG_TYPE_MASK = (1 << _TAG_TYPE_BITS) - 1; diff --git a/protobuf/pubspec.yaml b/protobuf/pubspec.yaml index 80f6032af..748914306 100644 --- a/protobuf/pubspec.yaml +++ b/protobuf/pubspec.yaml @@ -6,7 +6,7 @@ description: >- repository: https://github.com/google/protobuf.dart/tree/master/protobuf environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.19.0 <3.0.0' dependencies: collection: ^1.15.0 @@ -14,6 +14,6 @@ dependencies: meta: ^1.7.0 dev_dependencies: - lints: ^1.0.0 + dart_flutter_team_lints: ^1.0.0 matcher: ^0.12.11 test: ^1.16.0 diff --git a/protobuf/test/coded_buffer_reader_test.dart b/protobuf/test/coded_buffer_reader_test.dart index 48efd7660..987f8a7bf 100644 --- a/protobuf/test/coded_buffer_reader_test.dart +++ b/protobuf/test/coded_buffer_reader_test.dart @@ -113,9 +113,7 @@ void main() { final input = CodedBufferReader(output.toBuffer()); expect(input.readTag(), tag); - expect(() { - input.readBytes(); - }, throwsInvalidProtocolBufferException); + expect(input.readBytes, throwsInvalidProtocolBufferException); }); /// Tests that if we read a string that contains invalid UTF-8, no exception diff --git a/protobuf/test/event_test.dart b/protobuf/test/event_test.dart index a2d98b5bb..9be7a9a95 100644 --- a/protobuf/test/event_test.dart +++ b/protobuf/test/event_test.dart @@ -7,14 +7,14 @@ import 'package:protobuf/protobuf.dart'; import 'package:protobuf/src/protobuf/mixins/event_mixin.dart' show PbEventMixin, PbFieldChange; -import 'package:test/test.dart' show test, expect; +import 'package:test/test.dart' show expect, test; import 'mock_util.dart' show MockMessage, mockInfo; class Rec extends MockMessage with PbEventMixin { @override BuilderInfo get info_ => _info; - static final _info = mockInfo('Rec', () => Rec()); + static final _info = mockInfo('Rec', Rec.new); @override Rec createEmptyInstance() => Rec(); } @@ -25,9 +25,7 @@ void main() { test('Events are sent when setting and clearing a non-repeated field', () { final log = makeLog(); final r = Rec(); - r.changes.listen((List changes) { - log.add(changes); - }); + r.changes.listen(log.add); r.val = 123; r.deliverChanges(); @@ -53,9 +51,7 @@ void main() { test('Events are sent when creating and clearing a repeated field', () { final log = makeLog(); final r = Rec(); - r.changes.listen((List changes) { - log.add(changes); - }); + r.changes.listen(log.add); // Accessing a repeated field replaces the default, // read-only [] with a mutable [], @@ -201,9 +197,7 @@ void main() { test('Events are sent for extensions', () { final log = makeLog(); final r = Rec(); - r.changes.listen((List changes) { - log.add(changes); - }); + r.changes.listen(log.add); final tag = comment.tagNumber; void setComment(String value) { diff --git a/protobuf/test/json_test.dart b/protobuf/test/json_test.dart index 812d397d7..e67003896 100644 --- a/protobuf/test/json_test.dart +++ b/protobuf/test/json_test.dart @@ -34,8 +34,8 @@ void main() { () => example..mergeFromProto3Json({'enm': 'c'}), throwsA(allOf( isFormatException, - predicate( - (dynamic e) => e.message.contains('Unknown enum value'))))); + predicate((FormatException e) => + e.message.contains('Unknown enum value'))))); // `example` hasn't changed. expect(example.hasEnm, isTrue); expect(example.enm.name, equals('b')); @@ -55,8 +55,8 @@ void main() { () => example..mergeFromProto3Json({'enm': 3}), throwsA(allOf( isFormatException, - predicate( - (dynamic e) => e.message.contains('Unknown enum value'))))); + predicate((FormatException e) => + e.message.contains('Unknown enum value'))))); // `example` hasn't changed. expect(example.hasEnm, isTrue); expect(example.enm.name, equals('b')); diff --git a/protobuf/test/json_vm_test.dart b/protobuf/test/json_vm_test.dart index 09538f165..bab4bd37a 100644 --- a/protobuf/test/json_vm_test.dart +++ b/protobuf/test/json_vm_test.dart @@ -7,6 +7,7 @@ // These tests will be skipped on js, as the dart2js platform // does not support 64-bit ints. @TestOn('!js') +library; import 'package:fixnum/fixnum.dart' show Int64; import 'package:test/test.dart'; diff --git a/protobuf/test/list_test.dart b/protobuf/test/list_test.dart index d5626b3c8..4d29ece59 100644 --- a/protobuf/test/list_test.dart +++ b/protobuf/test/list_test.dart @@ -35,7 +35,7 @@ void main() { expect(lb1.lastIndexOf(99), 5); - expect(lb1.firstWhere((e) => e % 2 == 0), 0); + expect(lb1.firstWhere((e) => e.isEven), 0); expect(lb1.last, 99); final last = lb1.removeLast(); @@ -48,7 +48,7 @@ void main() { } expect(count, 108); - bool isEven(int i) => i % 2 == 0; + bool isEven(int i) => i.isEven; final evens = List.from(lb1.where(isEven)); expect(evens, [0, 2, 6]); @@ -91,7 +91,8 @@ void main() { test('PbList validates items', () { expect(() { - (PbList() as dynamic).add('hello'); + // ignore: unnecessary_cast + (PbList() as List).add('hello'); }, throwsA(TypeMatcher())); }); diff --git a/protobuf/test/map_mixin_test.dart b/protobuf/test/map_mixin_test.dart index 09316f19b..1608a46da 100644 --- a/protobuf/test/map_mixin_test.dart +++ b/protobuf/test/map_mixin_test.dart @@ -9,7 +9,8 @@ import 'dart:collection' show MapMixin; import 'package:protobuf/protobuf.dart'; import 'package:protobuf/src/protobuf/mixins/map_mixin.dart'; -import 'package:test/test.dart' show expect, same, test, throwsArgumentError; +import 'package:test/test.dart' + show expect, isA, same, test, throwsArgumentError; import 'mock_util.dart' show MockMessage, mockInfo; @@ -17,7 +18,7 @@ import 'mock_util.dart' show MockMessage, mockInfo; class Rec extends MockMessage with MapMixin, PbMapMixin { @override BuilderInfo get info_ => _info; - static final _info = mockInfo('Rec', () => Rec()); + static final _info = mockInfo('Rec', Rec.new); @override Rec createEmptyInstance() => Rec(); @@ -35,7 +36,7 @@ void main() { expect(r['val'], 42); expect(r['str'], ''); - expect(r['child'].runtimeType, Rec); + expect(r['child'], isA()); expect(r['child'].toString(), 'Rec(42, "")'); expect(r['int32s'], []); @@ -65,7 +66,7 @@ void main() { expect(r['child'], same(child)); expect(() => r['int32s'] = 123, throwsArgumentError); - r['int32s'].add(123); + (r['int32s'] as List).add(123); expect(r['int32s'], [123]); expect(r['int32s'], same(r['int32s'])); }); diff --git a/protobuf/test/message_test.dart b/protobuf/test/message_test.dart index c7e54dcb2..f733ca314 100644 --- a/protobuf/test/message_test.dart +++ b/protobuf/test/message_test.dart @@ -6,38 +6,34 @@ import 'package:matcher/src/interfaces.dart'; import 'package:protobuf/protobuf.dart'; -import 'package:test/test.dart' show test, expect, predicate, throwsA; +import 'package:test/test.dart' show expect, isA, test, throwsA; import 'mock_util.dart' show MockMessage, mockInfo; class Rec extends MockMessage { @override BuilderInfo get info_ => _info; - static final _info = mockInfo('Rec', () => Rec()); + static final _info = mockInfo('Rec', Rec.new); @override Rec createEmptyInstance() => Rec(); } -Matcher throwsError(Type expectedType, String expectedMessage) => - throwsA(predicate((dynamic x) { - expect(x.runtimeType, expectedType); - expect(x!.message, expectedMessage); - return true; - })); +Matcher throwsError(String expectedMessage) => throwsA(isA() + .having((p0) => p0.message, 'message', expectedMessage)); void main() { test('getField with invalid tag throws exception', () { final r = Rec(); expect(() { r.getField(123); - }, throwsError(ArgumentError, 'tag 123 not defined in Rec')); + }, throwsError('tag 123 not defined in Rec')); }); test('getDefaultForField with invalid tag throws exception', () { final r = Rec(); expect(() { r.getDefaultForField(123); - }, throwsError(ArgumentError, 'tag 123 not defined in Rec')); + }, throwsError('tag 123 not defined in Rec')); }); test('operator== and hashCode works for frozen message', () { diff --git a/protobuf/test/mock_util.dart b/protobuf/test/mock_util.dart index 60b40757c..731763547 100644 --- a/protobuf/test/mock_util.dart +++ b/protobuf/test/mock_util.dart @@ -60,7 +60,7 @@ abstract class MockMessage extends GeneratedMessage { class T extends MockMessage { @override BuilderInfo get info_ => _info; - static final _info = mockInfo('T', () => T()); + static final _info = mockInfo('T', T.new); @override T createEmptyInstance() => T(); } diff --git a/protobuf/test/readonly_message_test.dart b/protobuf/test/readonly_message_test.dart index 7ab001982..335fda650 100644 --- a/protobuf/test/readonly_message_test.dart +++ b/protobuf/test/readonly_message_test.dart @@ -6,12 +6,10 @@ import 'package:protobuf/protobuf.dart' show BuilderInfo, GeneratedMessage, PbFieldType, UnknownFieldSetField; import 'package:test/test.dart'; -Matcher throwsError(Type expectedType, Matcher expectedMessage) => - throwsA(predicate((dynamic x) { - expect(x.runtimeType, expectedType); - expect(x!.message, expectedMessage); - return true; - })); +Matcher throwsUnsupportedError(Matcher expectedMessage) => throwsA( + isA() + .having((p0) => p0.message, 'message', expectedMessage), + ); class Rec extends GeneratedMessage { static Rec getDefault() => Rec()..freeze(); @@ -56,53 +54,51 @@ void main() { test("can't merge to a read-only message", () { expect( () => Rec.getDefault().mergeFromJson('{"1":1}'), - throwsError(UnsupportedError, + throwsUnsupportedError( equals('Attempted to change a read-only message (rec)'))); }); test("can't set a field on a read-only message", () { expect( () => Rec.getDefault().setField(1, 456), - throwsError(UnsupportedError, + throwsUnsupportedError( equals('Attempted to change a read-only message (rec)'))); }); test("can't clear a read-only message", () { expect( () => Rec.getDefault().clear(), - throwsError(UnsupportedError, + throwsUnsupportedError( equals('Attempted to change a read-only message (rec)'))); }); test("can't clear a field on a read-only message", () { expect( () => Rec.getDefault().clearField(1), - throwsError(UnsupportedError, + throwsUnsupportedError( equals('Attempted to change a read-only message (rec)'))); }); test("can't modify repeated fields on a read-only message", () { expect(() => Rec.getDefault().sub.add(Rec.create()), - throwsError(UnsupportedError, contains('add'))); + throwsUnsupportedError(contains('add'))); var r = Rec.create() ..ints.add(10) ..freeze(); expect(() => r.ints.clear(), - throwsError(UnsupportedError, equals("'clear' on a read-only list"))); - expect( - () => r.ints[0] = 2, - throwsError( - UnsupportedError, equals("'set element' on a read-only list"))); + throwsUnsupportedError(equals("'clear' on a read-only list"))); + expect(() => r.ints[0] = 2, + throwsUnsupportedError(equals("'set element' on a read-only list"))); expect(() => r.sub.add(Rec.create()), - throwsError(UnsupportedError, equals("'add' on a read-only list"))); + throwsUnsupportedError(equals("'add' on a read-only list"))); r = Rec.create() ..sub.add(Rec.create()) ..freeze(); expect(() => r.sub.add(Rec.create()), - throwsError(UnsupportedError, equals("'add' on a read-only list"))); - expect(() => r.ints.length = 20, - throwsError(UnsupportedError, contains('length'))); + throwsUnsupportedError(equals("'add' on a read-only list"))); + expect( + () => r.ints.length = 20, throwsUnsupportedError(contains('length'))); }); test("can't modify sub-messages on a read-only message", () { @@ -113,17 +109,15 @@ void main() { expect(r.sub[0].sub[0].value, 1); expect( () => subMessage.value = 2, - throwsError(UnsupportedError, + throwsUnsupportedError( equals('Attempted to change a read-only message (rec)'))); }); test("can't modify unknown fields on a read-only message", () { expect( () => Rec.getDefault().unknownFields.clear(), - throwsError( - UnsupportedError, - equals( - 'Attempted to call clear on a read-only message (UnknownFieldSet)'))); + throwsUnsupportedError(equals( + 'Attempted to call clear on a read-only message (UnknownFieldSet)'))); }); test('can rebuild a frozen message with merge', () { @@ -202,11 +196,11 @@ void main() { final rebuilt = orig.copyWith((m) { expect( () => subMessage.value = 5, - throwsError(UnsupportedError, + throwsUnsupportedError( equals('Attempted to change a read-only message (rec)'))); expect( () => m.sub[0].sub[0].value = 2, - throwsError(UnsupportedError, + throwsUnsupportedError( equals('Attempted to change a read-only message (rec)'))); m.sub[0] = m.sub[0].copyWith( (m2) => m2.sub[0] = m2.sub[0].copyWith((m3) => m3.value = 2)); diff --git a/protoc_plugin/CHANGELOG.md b/protoc_plugin/CHANGELOG.md index a1ad2e41c..7bca4f35f 100644 --- a/protoc_plugin/CHANGELOG.md +++ b/protoc_plugin/CHANGELOG.md @@ -6,7 +6,7 @@ * Remove message constructor arguments. Constructors with arguments cause increase in release binary sizes even when no arguments are passed to the constructors. ([#703]) -* Require Dart `2.17`. +* Require Dart `2.19`. **Migration:** diff --git a/protoc_plugin/analysis_options.yaml b/protoc_plugin/analysis_options.yaml new file mode 100644 index 000000000..2a1174d71 --- /dev/null +++ b/protoc_plugin/analysis_options.yaml @@ -0,0 +1,6 @@ +include: ../analysis_options.yaml + +analyzer: + errors: + avoid_dynamic_calls: ignore + only_throw_errors: ignore diff --git a/protoc_plugin/lib/mixins.dart b/protoc_plugin/lib/mixins.dart index 6d4c4b2fa..f577d6966 100644 --- a/protoc_plugin/lib/mixins.dart +++ b/protoc_plugin/lib/mixins.dart @@ -4,6 +4,8 @@ /// Provides metadata about mixins to dart-protoc-plugin. /// (Experimental API; subject to change.) +library; + import 'indenting_writer.dart'; /// Finds [name] in the exported mixins. diff --git a/protoc_plugin/lib/src/generated/dart_options.pb.dart b/protoc_plugin/lib/src/generated/dart_options.pb.dart index 72a053d66..a9c525f36 100644 --- a/protoc_plugin/lib/src/generated/dart_options.pb.dart +++ b/protoc_plugin/lib/src/generated/dart_options.pb.dart @@ -7,13 +7,22 @@ // ignore_for_file: annotate_overrides, camel_case_types // ignore_for_file: constant_identifier_names, library_prefixes // ignore_for_file: non_constant_identifier_names, prefer_final_fields -// ignore_for_file: return_of_invalid_type, unnecessary_import, unnecessary_this +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import import 'dart:core' as $core; import 'package:protobuf/protobuf.dart' as $pb; class DartMixin extends $pb.GeneratedMessage { + factory DartMixin() => create(); + DartMixin._() : super(); + factory DartMixin.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory DartMixin.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + static final $pb.BuilderInfo _i = $pb.BuilderInfo( _omitMessageNames ? '' : 'DartMixin', package: const $pb.PackageName(_omitMessageNames ? '' : 'dart_options'), @@ -23,15 +32,6 @@ class DartMixin extends $pb.GeneratedMessage { ..aOS(3, _omitFieldNames ? '' : 'parent') ..hasRequiredFields = false; - DartMixin._() : super(); - factory DartMixin() => create(); - factory DartMixin.fromBuffer($core.List<$core.int> i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(i, r); - factory DartMixin.fromJson($core.String i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(i, r); - @$core.Deprecated('Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 'Will be removed in next major version') @@ -91,16 +91,8 @@ class DartMixin extends $pb.GeneratedMessage { } class Imports extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo( - _omitMessageNames ? '' : 'Imports', - package: const $pb.PackageName(_omitMessageNames ? '' : 'dart_options'), - createEmptyInstance: create) - ..pc(1, _omitFieldNames ? '' : 'mixins', $pb.PbFieldType.PM, - subBuilder: DartMixin.create) - ..hasRequiredFields = false; - - Imports._() : super(); factory Imports() => create(); + Imports._() : super(); factory Imports.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); @@ -108,6 +100,14 @@ class Imports extends $pb.GeneratedMessage { [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'Imports', + package: const $pb.PackageName(_omitMessageNames ? '' : 'dart_options'), + createEmptyInstance: create) + ..pc(1, _omitFieldNames ? '' : 'mixins', $pb.PbFieldType.PM, + subBuilder: DartMixin.create) + ..hasRequiredFields = false; + @$core.Deprecated('Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 'Will be removed in next major version') diff --git a/protoc_plugin/lib/src/generated/descriptor.pb.dart b/protoc_plugin/lib/src/generated/descriptor.pb.dart index f20c73a1c..90df2e82c 100644 --- a/protoc_plugin/lib/src/generated/descriptor.pb.dart +++ b/protoc_plugin/lib/src/generated/descriptor.pb.dart @@ -7,7 +7,7 @@ // ignore_for_file: annotate_overrides, camel_case_types // ignore_for_file: constant_identifier_names, library_prefixes // ignore_for_file: non_constant_identifier_names, prefer_final_fields -// ignore_for_file: return_of_invalid_type, unnecessary_import, unnecessary_this +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import import 'dart:core' as $core; @@ -19,6 +19,15 @@ import 'descriptor.pbenum.dart'; export 'descriptor.pbenum.dart'; class FileDescriptorSet extends $pb.GeneratedMessage { + factory FileDescriptorSet() => create(); + FileDescriptorSet._() : super(); + factory FileDescriptorSet.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory FileDescriptorSet.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + static final $pb.BuilderInfo _i = $pb.BuilderInfo( _omitMessageNames ? '' : 'FileDescriptorSet', package: @@ -28,15 +37,6 @@ class FileDescriptorSet extends $pb.GeneratedMessage { 1, _omitFieldNames ? '' : 'file', $pb.PbFieldType.PM, subBuilder: FileDescriptorProto.create); - FileDescriptorSet._() : super(); - factory FileDescriptorSet() => create(); - factory FileDescriptorSet.fromBuffer($core.List<$core.int> i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(i, r); - factory FileDescriptorSet.fromJson($core.String i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(i, r); - @$core.Deprecated('Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 'Will be removed in next major version') @@ -65,6 +65,15 @@ class FileDescriptorSet extends $pb.GeneratedMessage { } class FileDescriptorProto extends $pb.GeneratedMessage { + factory FileDescriptorProto() => create(); + FileDescriptorProto._() : super(); + factory FileDescriptorProto.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory FileDescriptorProto.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + static final $pb.BuilderInfo _i = $pb.BuilderInfo( _omitMessageNames ? '' : 'FileDescriptorProto', package: @@ -95,15 +104,6 @@ class FileDescriptorProto extends $pb.GeneratedMessage { 11, _omitFieldNames ? '' : 'weakDependency', $pb.PbFieldType.P3) ..aOS(12, _omitFieldNames ? '' : 'syntax'); - FileDescriptorProto._() : super(); - factory FileDescriptorProto() => create(); - factory FileDescriptorProto.fromBuffer($core.List<$core.int> i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(i, r); - factory FileDescriptorProto.fromJson($core.String i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(i, r); - @$core.Deprecated('Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 'Will be removed in next major version') @@ -214,6 +214,15 @@ class FileDescriptorProto extends $pb.GeneratedMessage { } class DescriptorProto_ExtensionRange extends $pb.GeneratedMessage { + factory DescriptorProto_ExtensionRange() => create(); + DescriptorProto_ExtensionRange._() : super(); + factory DescriptorProto_ExtensionRange.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory DescriptorProto_ExtensionRange.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + static final $pb.BuilderInfo _i = $pb.BuilderInfo( _omitMessageNames ? '' : 'DescriptorProto.ExtensionRange', package: @@ -224,15 +233,6 @@ class DescriptorProto_ExtensionRange extends $pb.GeneratedMessage { ..aOM(3, _omitFieldNames ? '' : 'options', subBuilder: ExtensionRangeOptions.create); - DescriptorProto_ExtensionRange._() : super(); - factory DescriptorProto_ExtensionRange() => create(); - factory DescriptorProto_ExtensionRange.fromBuffer($core.List<$core.int> i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(i, r); - factory DescriptorProto_ExtensionRange.fromJson($core.String i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(i, r); - @$core.Deprecated('Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 'Will be removed in next major version') @@ -300,6 +300,15 @@ class DescriptorProto_ExtensionRange extends $pb.GeneratedMessage { } class DescriptorProto_ReservedRange extends $pb.GeneratedMessage { + factory DescriptorProto_ReservedRange() => create(); + DescriptorProto_ReservedRange._() : super(); + factory DescriptorProto_ReservedRange.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory DescriptorProto_ReservedRange.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + static final $pb.BuilderInfo _i = $pb.BuilderInfo( _omitMessageNames ? '' : 'DescriptorProto.ReservedRange', package: @@ -309,15 +318,6 @@ class DescriptorProto_ReservedRange extends $pb.GeneratedMessage { ..a<$core.int>(2, _omitFieldNames ? '' : 'end', $pb.PbFieldType.O3) ..hasRequiredFields = false; - DescriptorProto_ReservedRange._() : super(); - factory DescriptorProto_ReservedRange() => create(); - factory DescriptorProto_ReservedRange.fromBuffer($core.List<$core.int> i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(i, r); - factory DescriptorProto_ReservedRange.fromJson($core.String i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(i, r); - @$core.Deprecated('Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 'Will be removed in next major version') @@ -371,6 +371,15 @@ class DescriptorProto_ReservedRange extends $pb.GeneratedMessage { } class DescriptorProto extends $pb.GeneratedMessage { + factory DescriptorProto() => create(); + DescriptorProto._() : super(); + factory DescriptorProto.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory DescriptorProto.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + static final $pb.BuilderInfo _i = $pb.BuilderInfo( _omitMessageNames ? '' : 'DescriptorProto', package: @@ -402,15 +411,6 @@ class DescriptorProto extends $pb.GeneratedMessage { subBuilder: DescriptorProto_ReservedRange.create) ..pPS(10, _omitFieldNames ? '' : 'reservedName'); - DescriptorProto._() : super(); - factory DescriptorProto() => create(); - factory DescriptorProto.fromBuffer($core.List<$core.int> i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(i, r); - factory DescriptorProto.fromJson($core.String i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(i, r); - @$core.Deprecated('Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 'Will be removed in next major version') @@ -486,6 +486,15 @@ class DescriptorProto extends $pb.GeneratedMessage { } class ExtensionRangeOptions extends $pb.GeneratedMessage { + factory ExtensionRangeOptions() => create(); + ExtensionRangeOptions._() : super(); + factory ExtensionRangeOptions.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory ExtensionRangeOptions.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + static final $pb.BuilderInfo _i = $pb.BuilderInfo( _omitMessageNames ? '' : 'ExtensionRangeOptions', package: @@ -496,15 +505,6 @@ class ExtensionRangeOptions extends $pb.GeneratedMessage { subBuilder: UninterpretedOption.create) ..hasExtensions = true; - ExtensionRangeOptions._() : super(); - factory ExtensionRangeOptions() => create(); - factory ExtensionRangeOptions.fromBuffer($core.List<$core.int> i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(i, r); - factory ExtensionRangeOptions.fromJson($core.String i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(i, r); - @$core.Deprecated('Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 'Will be removed in next major version') @@ -535,6 +535,15 @@ class ExtensionRangeOptions extends $pb.GeneratedMessage { } class FieldDescriptorProto extends $pb.GeneratedMessage { + factory FieldDescriptorProto() => create(); + FieldDescriptorProto._() : super(); + factory FieldDescriptorProto.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory FieldDescriptorProto.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + static final $pb.BuilderInfo _i = $pb.BuilderInfo( _omitMessageNames ? '' : 'FieldDescriptorProto', package: @@ -561,15 +570,6 @@ class FieldDescriptorProto extends $pb.GeneratedMessage { ..aOS(10, _omitFieldNames ? '' : 'jsonName') ..aOB(17, _omitFieldNames ? '' : 'proto3Optional'); - FieldDescriptorProto._() : super(); - factory FieldDescriptorProto() => create(); - factory FieldDescriptorProto.fromBuffer($core.List<$core.int> i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(i, r); - factory FieldDescriptorProto.fromJson($core.String i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(i, r); - @$core.Deprecated('Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 'Will be removed in next major version') @@ -730,6 +730,15 @@ class FieldDescriptorProto extends $pb.GeneratedMessage { } class OneofDescriptorProto extends $pb.GeneratedMessage { + factory OneofDescriptorProto() => create(); + OneofDescriptorProto._() : super(); + factory OneofDescriptorProto.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory OneofDescriptorProto.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + static final $pb.BuilderInfo _i = $pb.BuilderInfo( _omitMessageNames ? '' : 'OneofDescriptorProto', package: @@ -739,15 +748,6 @@ class OneofDescriptorProto extends $pb.GeneratedMessage { ..aOM(2, _omitFieldNames ? '' : 'options', subBuilder: OneofOptions.create); - OneofDescriptorProto._() : super(); - factory OneofDescriptorProto() => create(); - factory OneofDescriptorProto.fromBuffer($core.List<$core.int> i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(i, r); - factory OneofDescriptorProto.fromJson($core.String i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(i, r); - @$core.Deprecated('Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 'Will be removed in next major version') @@ -800,17 +800,8 @@ class OneofDescriptorProto extends $pb.GeneratedMessage { } class EnumDescriptorProto_EnumReservedRange extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo( - _omitMessageNames ? '' : 'EnumDescriptorProto.EnumReservedRange', - package: - const $pb.PackageName(_omitMessageNames ? '' : 'google.protobuf'), - createEmptyInstance: create) - ..a<$core.int>(1, _omitFieldNames ? '' : 'start', $pb.PbFieldType.O3) - ..a<$core.int>(2, _omitFieldNames ? '' : 'end', $pb.PbFieldType.O3) - ..hasRequiredFields = false; - - EnumDescriptorProto_EnumReservedRange._() : super(); factory EnumDescriptorProto_EnumReservedRange() => create(); + EnumDescriptorProto_EnumReservedRange._() : super(); factory EnumDescriptorProto_EnumReservedRange.fromBuffer( $core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => @@ -819,6 +810,15 @@ class EnumDescriptorProto_EnumReservedRange extends $pb.GeneratedMessage { [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'EnumDescriptorProto.EnumReservedRange', + package: + const $pb.PackageName(_omitMessageNames ? '' : 'google.protobuf'), + createEmptyInstance: create) + ..a<$core.int>(1, _omitFieldNames ? '' : 'start', $pb.PbFieldType.O3) + ..a<$core.int>(2, _omitFieldNames ? '' : 'end', $pb.PbFieldType.O3) + ..hasRequiredFields = false; + @$core.Deprecated('Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 'Will be removed in next major version') @@ -873,6 +873,15 @@ class EnumDescriptorProto_EnumReservedRange extends $pb.GeneratedMessage { } class EnumDescriptorProto extends $pb.GeneratedMessage { + factory EnumDescriptorProto() => create(); + EnumDescriptorProto._() : super(); + factory EnumDescriptorProto.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory EnumDescriptorProto.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + static final $pb.BuilderInfo _i = $pb.BuilderInfo( _omitMessageNames ? '' : 'EnumDescriptorProto', package: @@ -889,15 +898,6 @@ class EnumDescriptorProto extends $pb.GeneratedMessage { subBuilder: EnumDescriptorProto_EnumReservedRange.create) ..pPS(5, _omitFieldNames ? '' : 'reservedName'); - EnumDescriptorProto._() : super(); - factory EnumDescriptorProto() => create(); - factory EnumDescriptorProto.fromBuffer($core.List<$core.int> i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(i, r); - factory EnumDescriptorProto.fromJson($core.String i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(i, r); - @$core.Deprecated('Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 'Will be removed in next major version') @@ -959,6 +959,15 @@ class EnumDescriptorProto extends $pb.GeneratedMessage { } class EnumValueDescriptorProto extends $pb.GeneratedMessage { + factory EnumValueDescriptorProto() => create(); + EnumValueDescriptorProto._() : super(); + factory EnumValueDescriptorProto.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory EnumValueDescriptorProto.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + static final $pb.BuilderInfo _i = $pb.BuilderInfo( _omitMessageNames ? '' : 'EnumValueDescriptorProto', package: @@ -969,15 +978,6 @@ class EnumValueDescriptorProto extends $pb.GeneratedMessage { ..aOM(3, _omitFieldNames ? '' : 'options', subBuilder: EnumValueOptions.create); - EnumValueDescriptorProto._() : super(); - factory EnumValueDescriptorProto() => create(); - factory EnumValueDescriptorProto.fromBuffer($core.List<$core.int> i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(i, r); - factory EnumValueDescriptorProto.fromJson($core.String i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(i, r); - @$core.Deprecated('Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 'Will be removed in next major version') @@ -1043,6 +1043,15 @@ class EnumValueDescriptorProto extends $pb.GeneratedMessage { } class ServiceDescriptorProto extends $pb.GeneratedMessage { + factory ServiceDescriptorProto() => create(); + ServiceDescriptorProto._() : super(); + factory ServiceDescriptorProto.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory ServiceDescriptorProto.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + static final $pb.BuilderInfo _i = $pb.BuilderInfo( _omitMessageNames ? '' : 'ServiceDescriptorProto', package: @@ -1055,15 +1064,6 @@ class ServiceDescriptorProto extends $pb.GeneratedMessage { ..aOM(3, _omitFieldNames ? '' : 'options', subBuilder: ServiceOptions.create); - ServiceDescriptorProto._() : super(); - factory ServiceDescriptorProto() => create(); - factory ServiceDescriptorProto.fromBuffer($core.List<$core.int> i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(i, r); - factory ServiceDescriptorProto.fromJson($core.String i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(i, r); - @$core.Deprecated('Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 'Will be removed in next major version') @@ -1120,6 +1120,15 @@ class ServiceDescriptorProto extends $pb.GeneratedMessage { } class MethodDescriptorProto extends $pb.GeneratedMessage { + factory MethodDescriptorProto() => create(); + MethodDescriptorProto._() : super(); + factory MethodDescriptorProto.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory MethodDescriptorProto.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + static final $pb.BuilderInfo _i = $pb.BuilderInfo( _omitMessageNames ? '' : 'MethodDescriptorProto', package: @@ -1133,15 +1142,6 @@ class MethodDescriptorProto extends $pb.GeneratedMessage { ..aOB(5, _omitFieldNames ? '' : 'clientStreaming') ..aOB(6, _omitFieldNames ? '' : 'serverStreaming'); - MethodDescriptorProto._() : super(); - factory MethodDescriptorProto() => create(); - factory MethodDescriptorProto.fromBuffer($core.List<$core.int> i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(i, r); - factory MethodDescriptorProto.fromJson($core.String i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(i, r); - @$core.Deprecated('Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 'Will be removed in next major version') @@ -1243,6 +1243,15 @@ class MethodDescriptorProto extends $pb.GeneratedMessage { } class FileOptions extends $pb.GeneratedMessage { + factory FileOptions() => create(); + FileOptions._() : super(); + factory FileOptions.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory FileOptions.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + static final $pb.BuilderInfo _i = $pb.BuilderInfo( _omitMessageNames ? '' : 'FileOptions', package: @@ -1279,15 +1288,6 @@ class FileOptions extends $pb.GeneratedMessage { subBuilder: UninterpretedOption.create) ..hasExtensions = true; - FileOptions._() : super(); - factory FileOptions() => create(); - factory FileOptions.fromBuffer($core.List<$core.int> i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(i, r); - factory FileOptions.fromJson($core.String i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(i, r); - @$core.Deprecated('Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 'Will be removed in next major version') @@ -1559,6 +1559,15 @@ class FileOptions extends $pb.GeneratedMessage { } class MessageOptions extends $pb.GeneratedMessage { + factory MessageOptions() => create(); + MessageOptions._() : super(); + factory MessageOptions.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory MessageOptions.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + static final $pb.BuilderInfo _i = $pb.BuilderInfo( _omitMessageNames ? '' : 'MessageOptions', package: @@ -1573,15 +1582,6 @@ class MessageOptions extends $pb.GeneratedMessage { subBuilder: UninterpretedOption.create) ..hasExtensions = true; - MessageOptions._() : super(); - factory MessageOptions() => create(); - factory MessageOptions.fromBuffer($core.List<$core.int> i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(i, r); - factory MessageOptions.fromJson($core.String i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(i, r); - @$core.Deprecated('Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 'Will be removed in next major version') @@ -1658,6 +1658,15 @@ class MessageOptions extends $pb.GeneratedMessage { } class FieldOptions extends $pb.GeneratedMessage { + factory FieldOptions() => create(); + FieldOptions._() : super(); + factory FieldOptions.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory FieldOptions.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + static final $pb.BuilderInfo _i = $pb.BuilderInfo( _omitMessageNames ? '' : 'FieldOptions', package: @@ -1682,15 +1691,6 @@ class FieldOptions extends $pb.GeneratedMessage { subBuilder: UninterpretedOption.create) ..hasExtensions = true; - FieldOptions._() : super(); - factory FieldOptions() => create(); - factory FieldOptions.fromBuffer($core.List<$core.int> i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(i, r); - factory FieldOptions.fromJson($core.String i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(i, r); - @$core.Deprecated('Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 'Will be removed in next major version') @@ -1791,6 +1791,15 @@ class FieldOptions extends $pb.GeneratedMessage { } class OneofOptions extends $pb.GeneratedMessage { + factory OneofOptions() => create(); + OneofOptions._() : super(); + factory OneofOptions.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory OneofOptions.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + static final $pb.BuilderInfo _i = $pb.BuilderInfo( _omitMessageNames ? '' : 'OneofOptions', package: @@ -1801,15 +1810,6 @@ class OneofOptions extends $pb.GeneratedMessage { subBuilder: UninterpretedOption.create) ..hasExtensions = true; - OneofOptions._() : super(); - factory OneofOptions() => create(); - factory OneofOptions.fromBuffer($core.List<$core.int> i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(i, r); - factory OneofOptions.fromJson($core.String i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(i, r); - @$core.Deprecated('Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 'Will be removed in next major version') @@ -1838,6 +1838,15 @@ class OneofOptions extends $pb.GeneratedMessage { } class EnumOptions extends $pb.GeneratedMessage { + factory EnumOptions() => create(); + EnumOptions._() : super(); + factory EnumOptions.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory EnumOptions.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + static final $pb.BuilderInfo _i = $pb.BuilderInfo( _omitMessageNames ? '' : 'EnumOptions', package: @@ -1850,15 +1859,6 @@ class EnumOptions extends $pb.GeneratedMessage { subBuilder: UninterpretedOption.create) ..hasExtensions = true; - EnumOptions._() : super(); - factory EnumOptions() => create(); - factory EnumOptions.fromBuffer($core.List<$core.int> i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(i, r); - factory EnumOptions.fromJson($core.String i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(i, r); - @$core.Deprecated('Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 'Will be removed in next major version') @@ -1910,6 +1910,15 @@ class EnumOptions extends $pb.GeneratedMessage { } class EnumValueOptions extends $pb.GeneratedMessage { + factory EnumValueOptions() => create(); + EnumValueOptions._() : super(); + factory EnumValueOptions.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory EnumValueOptions.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + static final $pb.BuilderInfo _i = $pb.BuilderInfo( _omitMessageNames ? '' : 'EnumValueOptions', package: @@ -1921,15 +1930,6 @@ class EnumValueOptions extends $pb.GeneratedMessage { subBuilder: UninterpretedOption.create) ..hasExtensions = true; - EnumValueOptions._() : super(); - factory EnumValueOptions() => create(); - factory EnumValueOptions.fromBuffer($core.List<$core.int> i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(i, r); - factory EnumValueOptions.fromJson($core.String i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(i, r); - @$core.Deprecated('Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 'Will be removed in next major version') @@ -1970,6 +1970,15 @@ class EnumValueOptions extends $pb.GeneratedMessage { } class ServiceOptions extends $pb.GeneratedMessage { + factory ServiceOptions() => create(); + ServiceOptions._() : super(); + factory ServiceOptions.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory ServiceOptions.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + static final $pb.BuilderInfo _i = $pb.BuilderInfo( _omitMessageNames ? '' : 'ServiceOptions', package: @@ -1981,15 +1990,6 @@ class ServiceOptions extends $pb.GeneratedMessage { subBuilder: UninterpretedOption.create) ..hasExtensions = true; - ServiceOptions._() : super(); - factory ServiceOptions() => create(); - factory ServiceOptions.fromBuffer($core.List<$core.int> i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(i, r); - factory ServiceOptions.fromJson($core.String i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(i, r); - @$core.Deprecated('Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 'Will be removed in next major version') @@ -2030,6 +2030,15 @@ class ServiceOptions extends $pb.GeneratedMessage { } class MethodOptions extends $pb.GeneratedMessage { + factory MethodOptions() => create(); + MethodOptions._() : super(); + factory MethodOptions.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory MethodOptions.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + static final $pb.BuilderInfo _i = $pb.BuilderInfo( _omitMessageNames ? '' : 'MethodOptions', package: @@ -2046,15 +2055,6 @@ class MethodOptions extends $pb.GeneratedMessage { subBuilder: UninterpretedOption.create) ..hasExtensions = true; - MethodOptions._() : super(); - factory MethodOptions() => create(); - factory MethodOptions.fromBuffer($core.List<$core.int> i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(i, r); - factory MethodOptions.fromJson($core.String i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(i, r); - @$core.Deprecated('Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 'Will be removed in next major version') @@ -2107,6 +2107,15 @@ class MethodOptions extends $pb.GeneratedMessage { } class UninterpretedOption_NamePart extends $pb.GeneratedMessage { + factory UninterpretedOption_NamePart() => create(); + UninterpretedOption_NamePart._() : super(); + factory UninterpretedOption_NamePart.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory UninterpretedOption_NamePart.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + static final $pb.BuilderInfo _i = $pb.BuilderInfo( _omitMessageNames ? '' : 'UninterpretedOption.NamePart', package: @@ -2116,15 +2125,6 @@ class UninterpretedOption_NamePart extends $pb.GeneratedMessage { ..a<$core.bool>( 2, _omitFieldNames ? '' : 'isExtension', $pb.PbFieldType.QB); - UninterpretedOption_NamePart._() : super(); - factory UninterpretedOption_NamePart() => create(); - factory UninterpretedOption_NamePart.fromBuffer($core.List<$core.int> i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(i, r); - factory UninterpretedOption_NamePart.fromJson($core.String i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(i, r); - @$core.Deprecated('Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 'Will be removed in next major version') @@ -2178,6 +2178,15 @@ class UninterpretedOption_NamePart extends $pb.GeneratedMessage { } class UninterpretedOption extends $pb.GeneratedMessage { + factory UninterpretedOption() => create(); + UninterpretedOption._() : super(); + factory UninterpretedOption.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory UninterpretedOption.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + static final $pb.BuilderInfo _i = $pb.BuilderInfo( _omitMessageNames ? '' : 'UninterpretedOption', package: @@ -2197,15 +2206,6 @@ class UninterpretedOption extends $pb.GeneratedMessage { 7, _omitFieldNames ? '' : 'stringValue', $pb.PbFieldType.OY) ..aOS(8, _omitFieldNames ? '' : 'aggregateValue'); - UninterpretedOption._() : super(); - factory UninterpretedOption() => create(); - factory UninterpretedOption.fromBuffer($core.List<$core.int> i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(i, r); - factory UninterpretedOption.fromJson($core.String i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(i, r); - @$core.Deprecated('Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 'Will be removed in next major version') @@ -2306,6 +2306,15 @@ class UninterpretedOption extends $pb.GeneratedMessage { } class SourceCodeInfo_Location extends $pb.GeneratedMessage { + factory SourceCodeInfo_Location() => create(); + SourceCodeInfo_Location._() : super(); + factory SourceCodeInfo_Location.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory SourceCodeInfo_Location.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + static final $pb.BuilderInfo _i = $pb.BuilderInfo( _omitMessageNames ? '' : 'SourceCodeInfo.Location', package: @@ -2318,15 +2327,6 @@ class SourceCodeInfo_Location extends $pb.GeneratedMessage { ..pPS(6, _omitFieldNames ? '' : 'leadingDetachedComments') ..hasRequiredFields = false; - SourceCodeInfo_Location._() : super(); - factory SourceCodeInfo_Location() => create(); - factory SourceCodeInfo_Location.fromBuffer($core.List<$core.int> i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(i, r); - factory SourceCodeInfo_Location.fromJson($core.String i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(i, r); - @$core.Deprecated('Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 'Will be removed in next major version') @@ -2387,6 +2387,15 @@ class SourceCodeInfo_Location extends $pb.GeneratedMessage { } class SourceCodeInfo extends $pb.GeneratedMessage { + factory SourceCodeInfo() => create(); + SourceCodeInfo._() : super(); + factory SourceCodeInfo.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory SourceCodeInfo.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + static final $pb.BuilderInfo _i = $pb.BuilderInfo( _omitMessageNames ? '' : 'SourceCodeInfo', package: @@ -2397,15 +2406,6 @@ class SourceCodeInfo extends $pb.GeneratedMessage { subBuilder: SourceCodeInfo_Location.create) ..hasRequiredFields = false; - SourceCodeInfo._() : super(); - factory SourceCodeInfo() => create(); - factory SourceCodeInfo.fromBuffer($core.List<$core.int> i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(i, r); - factory SourceCodeInfo.fromJson($core.String i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(i, r); - @$core.Deprecated('Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 'Will be removed in next major version') @@ -2434,6 +2434,15 @@ class SourceCodeInfo extends $pb.GeneratedMessage { } class GeneratedCodeInfo_Annotation extends $pb.GeneratedMessage { + factory GeneratedCodeInfo_Annotation() => create(); + GeneratedCodeInfo_Annotation._() : super(); + factory GeneratedCodeInfo_Annotation.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory GeneratedCodeInfo_Annotation.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + static final $pb.BuilderInfo _i = $pb.BuilderInfo( _omitMessageNames ? '' : 'GeneratedCodeInfo.Annotation', package: @@ -2445,15 +2454,6 @@ class GeneratedCodeInfo_Annotation extends $pb.GeneratedMessage { ..a<$core.int>(4, _omitFieldNames ? '' : 'end', $pb.PbFieldType.O3) ..hasRequiredFields = false; - GeneratedCodeInfo_Annotation._() : super(); - factory GeneratedCodeInfo_Annotation() => create(); - factory GeneratedCodeInfo_Annotation.fromBuffer($core.List<$core.int> i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(i, r); - factory GeneratedCodeInfo_Annotation.fromJson($core.String i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(i, r); - @$core.Deprecated('Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 'Will be removed in next major version') @@ -2522,6 +2522,15 @@ class GeneratedCodeInfo_Annotation extends $pb.GeneratedMessage { } class GeneratedCodeInfo extends $pb.GeneratedMessage { + factory GeneratedCodeInfo() => create(); + GeneratedCodeInfo._() : super(); + factory GeneratedCodeInfo.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory GeneratedCodeInfo.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + static final $pb.BuilderInfo _i = $pb.BuilderInfo( _omitMessageNames ? '' : 'GeneratedCodeInfo', package: @@ -2532,15 +2541,6 @@ class GeneratedCodeInfo extends $pb.GeneratedMessage { subBuilder: GeneratedCodeInfo_Annotation.create) ..hasRequiredFields = false; - GeneratedCodeInfo._() : super(); - factory GeneratedCodeInfo() => create(); - factory GeneratedCodeInfo.fromBuffer($core.List<$core.int> i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(i, r); - factory GeneratedCodeInfo.fromJson($core.String i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(i, r); - @$core.Deprecated('Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 'Will be removed in next major version') diff --git a/protoc_plugin/lib/src/generated/descriptor.pbenum.dart b/protoc_plugin/lib/src/generated/descriptor.pbenum.dart index 3f2a0d44a..949b9c5f3 100644 --- a/protoc_plugin/lib/src/generated/descriptor.pbenum.dart +++ b/protoc_plugin/lib/src/generated/descriptor.pbenum.dart @@ -7,8 +7,7 @@ // ignore_for_file: annotate_overrides, camel_case_types // ignore_for_file: constant_identifier_names, library_prefixes // ignore_for_file: non_constant_identifier_names, prefer_final_fields -// ignore_for_file: return_of_invalid_type -// ignore_for_file: unnecessary_this +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import import 'dart:core' as $core; diff --git a/protoc_plugin/lib/src/generated/plugin.pb.dart b/protoc_plugin/lib/src/generated/plugin.pb.dart index 82f4917b7..6ac13112a 100644 --- a/protoc_plugin/lib/src/generated/plugin.pb.dart +++ b/protoc_plugin/lib/src/generated/plugin.pb.dart @@ -7,7 +7,7 @@ // ignore_for_file: annotate_overrides, camel_case_types // ignore_for_file: constant_identifier_names, library_prefixes // ignore_for_file: non_constant_identifier_names, prefer_final_fields -// ignore_for_file: return_of_invalid_type, unnecessary_import, unnecessary_this +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import import 'dart:core' as $core; @@ -19,6 +19,15 @@ import 'descriptor.pb.dart' as $0; export 'plugin.pbenum.dart'; class Version extends $pb.GeneratedMessage { + factory Version() => create(); + Version._() : super(); + factory Version.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory Version.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + static final $pb.BuilderInfo _i = $pb.BuilderInfo( _omitMessageNames ? '' : 'Version', package: const $pb.PackageName( @@ -30,15 +39,6 @@ class Version extends $pb.GeneratedMessage { ..aOS(4, _omitFieldNames ? '' : 'suffix') ..hasRequiredFields = false; - Version._() : super(); - factory Version() => create(); - factory Version.fromBuffer($core.List<$core.int> i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(i, r); - factory Version.fromJson($core.String i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(i, r); - @$core.Deprecated('Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 'Will be removed in next major version') @@ -110,6 +110,15 @@ class Version extends $pb.GeneratedMessage { } class CodeGeneratorRequest extends $pb.GeneratedMessage { + factory CodeGeneratorRequest() => create(); + CodeGeneratorRequest._() : super(); + factory CodeGeneratorRequest.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory CodeGeneratorRequest.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + static final $pb.BuilderInfo _i = $pb.BuilderInfo( _omitMessageNames ? '' : 'CodeGeneratorRequest', package: const $pb.PackageName( @@ -123,15 +132,6 @@ class CodeGeneratorRequest extends $pb.GeneratedMessage { 15, _omitFieldNames ? '' : 'protoFile', $pb.PbFieldType.PM, subBuilder: $0.FileDescriptorProto.create); - CodeGeneratorRequest._() : super(); - factory CodeGeneratorRequest() => create(); - factory CodeGeneratorRequest.fromBuffer($core.List<$core.int> i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(i, r); - factory CodeGeneratorRequest.fromJson($core.String i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(i, r); - @$core.Deprecated('Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 'Will be removed in next major version') @@ -190,6 +190,15 @@ class CodeGeneratorRequest extends $pb.GeneratedMessage { } class CodeGeneratorResponse_File extends $pb.GeneratedMessage { + factory CodeGeneratorResponse_File() => create(); + CodeGeneratorResponse_File._() : super(); + factory CodeGeneratorResponse_File.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory CodeGeneratorResponse_File.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + static final $pb.BuilderInfo _i = $pb.BuilderInfo( _omitMessageNames ? '' : 'CodeGeneratorResponse.File', package: const $pb.PackageName( @@ -202,15 +211,6 @@ class CodeGeneratorResponse_File extends $pb.GeneratedMessage { subBuilder: $0.GeneratedCodeInfo.create) ..hasRequiredFields = false; - CodeGeneratorResponse_File._() : super(); - factory CodeGeneratorResponse_File() => create(); - factory CodeGeneratorResponse_File.fromBuffer($core.List<$core.int> i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(i, r); - factory CodeGeneratorResponse_File.fromJson($core.String i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(i, r); - @$core.Deprecated('Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 'Will be removed in next major version') @@ -289,6 +289,15 @@ class CodeGeneratorResponse_File extends $pb.GeneratedMessage { } class CodeGeneratorResponse extends $pb.GeneratedMessage { + factory CodeGeneratorResponse() => create(); + CodeGeneratorResponse._() : super(); + factory CodeGeneratorResponse.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory CodeGeneratorResponse.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + static final $pb.BuilderInfo _i = $pb.BuilderInfo( _omitMessageNames ? '' : 'CodeGeneratorResponse', package: const $pb.PackageName( @@ -303,15 +312,6 @@ class CodeGeneratorResponse extends $pb.GeneratedMessage { subBuilder: CodeGeneratorResponse_File.create) ..hasRequiredFields = false; - CodeGeneratorResponse._() : super(); - factory CodeGeneratorResponse() => create(); - factory CodeGeneratorResponse.fromBuffer($core.List<$core.int> i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(i, r); - factory CodeGeneratorResponse.fromJson($core.String i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(i, r); - @$core.Deprecated('Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 'Will be removed in next major version') diff --git a/protoc_plugin/lib/src/generated/plugin.pbenum.dart b/protoc_plugin/lib/src/generated/plugin.pbenum.dart index 77d56e6a8..b70440027 100644 --- a/protoc_plugin/lib/src/generated/plugin.pbenum.dart +++ b/protoc_plugin/lib/src/generated/plugin.pbenum.dart @@ -7,8 +7,7 @@ // ignore_for_file: annotate_overrides, camel_case_types // ignore_for_file: constant_identifier_names, library_prefixes // ignore_for_file: non_constant_identifier_names, prefer_final_fields -// ignore_for_file: return_of_invalid_type, undefined_shown_name -// ignore_for_file: unnecessary_this +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import import 'dart:core' as $core; diff --git a/protoc_plugin/pubspec.yaml b/protoc_plugin/pubspec.yaml index 26d02432b..9d41023ab 100644 --- a/protoc_plugin/pubspec.yaml +++ b/protoc_plugin/pubspec.yaml @@ -4,7 +4,7 @@ description: A protobuf protoc compiler plugin used to generate Dart code. repository: https://github.com/google/protobuf.dart/tree/master/protoc_plugin environment: - sdk: '>=2.17.0 <3.0.0' + sdk: '>=2.19.0 <3.0.0' dependencies: fixnum: ^1.0.0 @@ -13,7 +13,7 @@ dependencies: dev_dependencies: collection: ^1.15.0 - lints: ^1.0.0 + dart_flutter_team_lints: ^1.0.0 matcher: ^0.12.10 test: ^1.16.0 diff --git a/protoc_plugin/test/map_test.dart b/protoc_plugin/test/map_test.dart index cf4e7cbd0..e99958a46 100644 --- a/protoc_plugin/test/map_test.dart +++ b/protoc_plugin/test/map_test.dart @@ -3,7 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import 'package:test/test.dart' - show test, expect, predicate, same, throwsA, throwsArgumentError, isA; + show expect, isA, predicate, same, test, throwsA, throwsArgumentError; import '../out/protos/map_api.pb.dart' as pb; import '../out/protos/map_api2.pb.dart' as pb2; diff --git a/protoc_plugin/test/merge_test.dart b/protoc_plugin/test/merge_test.dart index f0b9efa6f..827cd45c8 100644 --- a/protoc_plugin/test/merge_test.dart +++ b/protoc_plugin/test/merge_test.dart @@ -3,7 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import 'package:fixnum/fixnum.dart'; -import 'package:test/test.dart' show test, expect; +import 'package:test/test.dart' show expect, test; import '../out/protos/foo.pb.dart' as pb; diff --git a/protoc_plugin/test/message_test.dart b/protoc_plugin/test/message_test.dart index 6c899bd52..9064721a1 100644 --- a/protoc_plugin/test/message_test.dart +++ b/protoc_plugin/test/message_test.dart @@ -107,12 +107,16 @@ repeatedString: qux }); test('testUninitializedException', () { - try { - TestRequired().check(); - fail('Should have thrown an exception.'); - } on StateError catch (e) { - expect(e.message, 'Message missing required fields: a, b, c'); - } + expect( + () => TestRequired().check(), + throwsA( + isA().having( + (p0) => p0.message, + 'message', + 'Message missing required fields: a, b, c', + ), + ), + ); }); test('testBuildPartial', () { @@ -122,30 +126,32 @@ repeatedString: qux }); test('testNestedUninitializedException', () { - try { - final message = TestRequiredForeign(); - message.optionalMessage = testRequiredUninitialized; - message.repeatedMessage.add(testRequiredUninitialized); - message.repeatedMessage.add(testRequiredUninitialized); - message.check(); - fail('Should have thrown an exception.'); - } on StateError catch (e) { + final message = TestRequiredForeign(); + message.optionalMessage = testRequiredUninitialized; + message.repeatedMessage.add(testRequiredUninitialized); + message.repeatedMessage.add(testRequiredUninitialized); + expect( + message.check, // NOTE: error message differs from Java in that // fields are referenced using Dart fieldnames r.t. // proto field names. - expect( - e.message, + throwsA( + isA().having( + (p0) => p0.message, + 'message', 'Message missing required fields: ' - 'optionalMessage.a, ' - 'optionalMessage.b, ' - 'optionalMessage.c, ' - 'repeatedMessage[0].a, ' - 'repeatedMessage[0].b, ' - 'repeatedMessage[0].c, ' - 'repeatedMessage[1].a, ' - 'repeatedMessage[1].b, ' - 'repeatedMessage[1].c'); - } + 'optionalMessage.a, ' + 'optionalMessage.b, ' + 'optionalMessage.c, ' + 'repeatedMessage[0].a, ' + 'repeatedMessage[0].b, ' + 'repeatedMessage[0].c, ' + 'repeatedMessage[1].a, ' + 'repeatedMessage[1].b, ' + 'repeatedMessage[1].c', + ), + ), + ); }); test('testBuildNestedPartial', () { @@ -158,12 +164,16 @@ repeatedString: qux }); test('testParseUnititialized', () { - try { - TestRequired.fromBuffer([]).check(); - fail('Should have thrown an exception.'); - } on StateError catch (e) { - expect(e.message, 'Message missing required fields: a, b, c'); - } + expect( + () => TestRequired.fromBuffer([]).check(), + throwsA( + isA().having( + (p0) => p0.message, + 'message', + 'Message missing required fields: a, b, c', + ), + ), + ); }); test('testParseNestedUnititialized', () { @@ -173,26 +183,28 @@ repeatedString: qux message.repeatedMessage.add(testRequiredUninitialized); final List buffer = message.writeToBuffer(); - try { - (TestRequiredForeign.fromBuffer(buffer)).check(); - fail('Should have thrown an exception.'); - } on StateError catch (e) { + expect( + () => TestRequiredForeign.fromBuffer(buffer).check(), // NOTE: error message differs from Java in that // fields are referenced using Dart fieldnames r.t. // proto field names. - expect( - e.message, + throwsA( + isA().having( + (p0) => p0.message, + 'message', 'Message missing required fields: ' - 'optionalMessage.a, ' - 'optionalMessage.b, ' - 'optionalMessage.c, ' - 'repeatedMessage[0].a, ' - 'repeatedMessage[0].b, ' - 'repeatedMessage[0].c, ' - 'repeatedMessage[1].a, ' - 'repeatedMessage[1].b, ' - 'repeatedMessage[1].c'); - } + 'optionalMessage.a, ' + 'optionalMessage.b, ' + 'optionalMessage.c, ' + 'repeatedMessage[0].a, ' + 'repeatedMessage[0].b, ' + 'repeatedMessage[0].c, ' + 'repeatedMessage[1].a, ' + 'repeatedMessage[1].b, ' + 'repeatedMessage[1].c', + ), + ), + ); }); test('testClearField', () {