Require Dart 2.19, migrate to dart_flutter_team_lints, make associated fixes (dart-lang/yaml#138)
diff --git a/pkgs/yaml/.github/workflows/test-package.yml b/pkgs/yaml/.github/workflows/test-package.yml index 908a67f..20b28de 100644 --- a/pkgs/yaml/.github/workflows/test-package.yml +++ b/pkgs/yaml/.github/workflows/test-package.yml
@@ -47,7 +47,7 @@ matrix: # Add macos-latest and/or windows-latest if relevant for this package. os: [ubuntu-latest] - sdk: [dev] + sdk: [2.19.0, dev] steps: - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c - uses: dart-lang/setup-dart@a57a6c04cf7d4840e88432aad6281d1e125f0d46
diff --git a/pkgs/yaml/CHANGELOG.md b/pkgs/yaml/CHANGELOG.md index d0623cd..2a4cc16 100644 --- a/pkgs/yaml/CHANGELOG.md +++ b/pkgs/yaml/CHANGELOG.md
@@ -1,3 +1,7 @@ +## 3.1.2-dev + +* Require Dart 2.19 + ## 3.1.1 * Switch to using package:lints.
diff --git a/pkgs/yaml/analysis_options.yaml b/pkgs/yaml/analysis_options.yaml index 6307140..6c0172b 100644 --- a/pkgs/yaml/analysis_options.yaml +++ b/pkgs/yaml/analysis_options.yaml
@@ -1,4 +1,4 @@ -include: package:lints/recommended.yaml +include: package:dart_flutter_team_lints/analysis_options.yaml analyzer: language: @@ -6,31 +6,17 @@ linter: rules: - - avoid_catching_errors - avoid_private_typedef_functions - avoid_redundant_argument_values - avoid_unused_constructor_parameters - cancel_subscriptions - - directives_ordering - join_return_with_assignment - - lines_longer_than_80_chars - missing_whitespace_between_adjacent_strings - no_runtimeType_toString - - only_throw_errors - package_api_docs - - prefer_asserts_in_initializer_lists - prefer_const_declarations - prefer_expression_function_bodies - - prefer_interpolation_to_compose_strings - prefer_relative_imports - - prefer_single_quotes - - sort_pub_dependencies - test_types_in_equals - - throw_in_finally - - type_annotate_public_apis - - unnecessary_lambdas - - unnecessary_null_aware_assignments - - unnecessary_parenthesis - - unnecessary_statements - - use_is_even_rather_than_modulo - use_string_buffers + - use_super_parameters
diff --git a/pkgs/yaml/benchmark/benchmark.dart b/pkgs/yaml/benchmark/benchmark.dart index bdb21db..afc3c97 100644 --- a/pkgs/yaml/benchmark/benchmark.dart +++ b/pkgs/yaml/benchmark/benchmark.dart
@@ -5,8 +5,6 @@ // license that can be found in the LICENSE file or at // https://opensource.org/licenses/MIT. -library yaml.benchmark.benchmark; - import 'dart:convert'; import 'dart:io';
diff --git a/pkgs/yaml/lib/src/equality.dart b/pkgs/yaml/lib/src/equality.dart index f0755ca..77cf8e0 100644 --- a/pkgs/yaml/lib/src/equality.dart +++ b/pkgs/yaml/lib/src/equality.dart
@@ -103,15 +103,15 @@ int deepHashCode(Object? obj) { var parents = []; - int _deepHashCode(value) { + int deepHashCodeInner(value) { if (parents.any((parent) => identical(parent, value))) return -1; parents.add(value); try { if (value is Map) { var equality = const UnorderedIterableEquality(); - return equality.hash(value.keys.map(_deepHashCode)) ^ - equality.hash(value.values.map(_deepHashCode)); + return equality.hash(value.keys.map(deepHashCodeInner)) ^ + equality.hash(value.values.map(deepHashCodeInner)); } else if (value is Iterable) { return const IterableEquality().hash(value.map(deepHashCode)); } else if (value is YamlScalar) { @@ -124,5 +124,5 @@ } } - return _deepHashCode(obj); + return deepHashCodeInner(obj); }
diff --git a/pkgs/yaml/lib/src/yaml_exception.dart b/pkgs/yaml/lib/src/yaml_exception.dart index 1e6fb2e..7aa5389 100644 --- a/pkgs/yaml/lib/src/yaml_exception.dart +++ b/pkgs/yaml/lib/src/yaml_exception.dart
@@ -9,5 +9,5 @@ /// An error thrown by the YAML processor. class YamlException extends SourceSpanFormatException { - YamlException(String message, SourceSpan? span) : super(message, span); + YamlException(super.message, super.span); }
diff --git a/pkgs/yaml/lib/src/yaml_node.dart b/pkgs/yaml/lib/src/yaml_node.dart index 458a61f..fb10de3 100644 --- a/pkgs/yaml/lib/src/yaml_node.dart +++ b/pkgs/yaml/lib/src/yaml_node.dart
@@ -61,7 +61,7 @@ Map get value => this; @override - Iterable get keys => nodes.keys.map((node) => node.value); + Iterable get keys => nodes.keys.map((node) => (node as YamlNode).value); /// Creates an empty YamlMap. /// @@ -86,9 +86,9 @@ YamlMapWrapper(dartMap, sourceUrl, style: style); /// Users of the library should not use this constructor. - YamlMap.internal(Map<dynamic, YamlNode> nodes, SourceSpan span, this.style) + YamlMap.internal(Map<dynamic, YamlNode> nodes, super.span, this.style) : nodes = UnmodifiableMapView<dynamic, YamlNode>(nodes), - super._(span); + super._(); @override dynamic operator [](Object? key) => nodes[key]?.value; @@ -136,9 +136,9 @@ YamlListWrapper(dartList, sourceUrl, style: style); /// Users of the library should not use this constructor. - YamlList.internal(List<YamlNode> nodes, SourceSpan span, this.style) + YamlList.internal(List<YamlNode> nodes, super.span, this.style) : nodes = UnmodifiableListView<YamlNode>(nodes), - super._(span); + super._(); @override dynamic operator [](int index) => nodes[index].value; @@ -152,7 +152,7 @@ /// A wrapped scalar value parsed from YAML. class YamlScalar extends YamlNode { @override - final dynamic value; + final Object? value; /// The style used for the scalar in the original document. final ScalarStyle style;
diff --git a/pkgs/yaml/pubspec.yaml b/pkgs/yaml/pubspec.yaml index c97d33f..899ed0f 100644 --- a/pkgs/yaml/pubspec.yaml +++ b/pkgs/yaml/pubspec.yaml
@@ -1,10 +1,10 @@ name: yaml -version: 3.1.1 +version: 3.1.2-dev description: A parser for YAML, a human-friendly data serialization standard repository: https://github.com/dart-lang/yaml environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.19.0 <3.0.0' dependencies: collection: ^1.15.0 @@ -12,6 +12,6 @@ string_scanner: ^1.1.0 dev_dependencies: - lints: ^1.0.0 + dart_flutter_team_lints: ^1.0.0 path: ^1.8.0 test: ^1.16.0
diff --git a/pkgs/yaml/test/yaml_node_wrapper_test.dart b/pkgs/yaml/test/yaml_node_wrapper_test.dart index a7bf6b1..699066e 100644 --- a/pkgs/yaml/test/yaml_node_wrapper_test.dart +++ b/pkgs/yaml/test/yaml_node_wrapper_test.dart
@@ -5,6 +5,8 @@ // license that can be found in the LICENSE file or at // https://opensource.org/licenses/MIT. +// ignore_for_file: avoid_dynamic_calls + import 'package:source_span/source_span.dart'; import 'package:test/test.dart'; import 'package:yaml/yaml.dart';
diff --git a/pkgs/yaml/test/yaml_test.dart b/pkgs/yaml/test/yaml_test.dart index a0cb553..d226924 100644 --- a/pkgs/yaml/test/yaml_test.dart +++ b/pkgs/yaml/test/yaml_test.dart
@@ -5,6 +5,8 @@ // license that can be found in the LICENSE file or at // https://opensource.org/licenses/MIT. +// ignore_for_file: avoid_dynamic_calls + import 'package:test/test.dart'; import 'package:yaml/src/error_listener.dart'; import 'package:yaml/yaml.dart';