Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit 1ad2f49

Browse files
authored
Require Dart 2.19, migrate to dart_flutter_team_lints, make associated fixes (#138)
1 parent 4d369fd commit 1ad2f49

File tree

10 files changed

+25
-33
lines changed

10 files changed

+25
-33
lines changed

.github/workflows/test-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
matrix:
4848
# Add macos-latest and/or windows-latest if relevant for this package.
4949
os: [ubuntu-latest]
50-
sdk: [dev]
50+
sdk: [2.19.0, dev]
5151
steps:
5252
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
5353
- uses: dart-lang/setup-dart@a57a6c04cf7d4840e88432aad6281d1e125f0d46

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 3.1.2-dev
2+
3+
* Require Dart 2.19
4+
15
## 3.1.1
26

37
* Switch to using package:lints.

analysis_options.yaml

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,22 @@
1-
include: package:lints/recommended.yaml
1+
include: package:dart_flutter_team_lints/analysis_options.yaml
22

33
analyzer:
44
language:
55
strict-casts: true
66

77
linter:
88
rules:
9-
- avoid_catching_errors
109
- avoid_private_typedef_functions
1110
- avoid_redundant_argument_values
1211
- avoid_unused_constructor_parameters
1312
- cancel_subscriptions
14-
- directives_ordering
1513
- join_return_with_assignment
16-
- lines_longer_than_80_chars
1714
- missing_whitespace_between_adjacent_strings
1815
- no_runtimeType_toString
19-
- only_throw_errors
2016
- package_api_docs
21-
- prefer_asserts_in_initializer_lists
2217
- prefer_const_declarations
2318
- prefer_expression_function_bodies
24-
- prefer_interpolation_to_compose_strings
2519
- prefer_relative_imports
26-
- prefer_single_quotes
27-
- sort_pub_dependencies
2820
- test_types_in_equals
29-
- throw_in_finally
30-
- type_annotate_public_apis
31-
- unnecessary_lambdas
32-
- unnecessary_null_aware_assignments
33-
- unnecessary_parenthesis
34-
- unnecessary_statements
35-
- use_is_even_rather_than_modulo
3621
- use_string_buffers
22+
- use_super_parameters

benchmark/benchmark.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
// license that can be found in the LICENSE file or at
66
// https://opensource.org/licenses/MIT.
77

8-
library yaml.benchmark.benchmark;
9-
108
import 'dart:convert';
119
import 'dart:io';
1210

lib/src/equality.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,15 @@ class _DeepEquals {
103103
int deepHashCode(Object? obj) {
104104
var parents = [];
105105

106-
int _deepHashCode(value) {
106+
int deepHashCodeInner(value) {
107107
if (parents.any((parent) => identical(parent, value))) return -1;
108108

109109
parents.add(value);
110110
try {
111111
if (value is Map) {
112112
var equality = const UnorderedIterableEquality();
113-
return equality.hash(value.keys.map(_deepHashCode)) ^
114-
equality.hash(value.values.map(_deepHashCode));
113+
return equality.hash(value.keys.map(deepHashCodeInner)) ^
114+
equality.hash(value.values.map(deepHashCodeInner));
115115
} else if (value is Iterable) {
116116
return const IterableEquality().hash(value.map(deepHashCode));
117117
} else if (value is YamlScalar) {
@@ -124,5 +124,5 @@ int deepHashCode(Object? obj) {
124124
}
125125
}
126126

127-
return _deepHashCode(obj);
127+
return deepHashCodeInner(obj);
128128
}

lib/src/yaml_exception.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ import 'package:source_span/source_span.dart';
99

1010
/// An error thrown by the YAML processor.
1111
class YamlException extends SourceSpanFormatException {
12-
YamlException(String message, SourceSpan? span) : super(message, span);
12+
YamlException(super.message, super.span);
1313
}

lib/src/yaml_node.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class YamlMap extends YamlNode with collection.MapMixin, UnmodifiableMapMixin {
6161
Map get value => this;
6262

6363
@override
64-
Iterable get keys => nodes.keys.map((node) => node.value);
64+
Iterable get keys => nodes.keys.map((node) => (node as YamlNode).value);
6565

6666
/// Creates an empty YamlMap.
6767
///
@@ -86,9 +86,9 @@ class YamlMap extends YamlNode with collection.MapMixin, UnmodifiableMapMixin {
8686
YamlMapWrapper(dartMap, sourceUrl, style: style);
8787

8888
/// Users of the library should not use this constructor.
89-
YamlMap.internal(Map<dynamic, YamlNode> nodes, SourceSpan span, this.style)
89+
YamlMap.internal(Map<dynamic, YamlNode> nodes, super.span, this.style)
9090
: nodes = UnmodifiableMapView<dynamic, YamlNode>(nodes),
91-
super._(span);
91+
super._();
9292

9393
@override
9494
dynamic operator [](Object? key) => nodes[key]?.value;
@@ -136,9 +136,9 @@ class YamlList extends YamlNode with collection.ListMixin {
136136
YamlListWrapper(dartList, sourceUrl, style: style);
137137

138138
/// Users of the library should not use this constructor.
139-
YamlList.internal(List<YamlNode> nodes, SourceSpan span, this.style)
139+
YamlList.internal(List<YamlNode> nodes, super.span, this.style)
140140
: nodes = UnmodifiableListView<YamlNode>(nodes),
141-
super._(span);
141+
super._();
142142

143143
@override
144144
dynamic operator [](int index) => nodes[index].value;
@@ -152,7 +152,7 @@ class YamlList extends YamlNode with collection.ListMixin {
152152
/// A wrapped scalar value parsed from YAML.
153153
class YamlScalar extends YamlNode {
154154
@override
155-
final dynamic value;
155+
final Object? value;
156156

157157
/// The style used for the scalar in the original document.
158158
final ScalarStyle style;

pubspec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
name: yaml
2-
version: 3.1.1
2+
version: 3.1.2-dev
33
description: A parser for YAML, a human-friendly data serialization standard
44
repository: https://github.com/dart-lang/yaml
55

66
environment:
7-
sdk: '>=2.12.0 <3.0.0'
7+
sdk: '>=2.19.0 <3.0.0'
88

99
dependencies:
1010
collection: ^1.15.0
1111
source_span: ^1.8.0
1212
string_scanner: ^1.1.0
1313

1414
dev_dependencies:
15-
lints: ^1.0.0
15+
dart_flutter_team_lints: ^1.0.0
1616
path: ^1.8.0
1717
test: ^1.16.0

test/yaml_node_wrapper_test.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
// license that can be found in the LICENSE file or at
66
// https://opensource.org/licenses/MIT.
77

8+
// ignore_for_file: avoid_dynamic_calls
9+
810
import 'package:source_span/source_span.dart';
911
import 'package:test/test.dart';
1012
import 'package:yaml/yaml.dart';

test/yaml_test.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
// license that can be found in the LICENSE file or at
66
// https://opensource.org/licenses/MIT.
77

8+
// ignore_for_file: avoid_dynamic_calls
9+
810
import 'package:test/test.dart';
911
import 'package:yaml/src/error_listener.dart';
1012
import 'package:yaml/yaml.dart';

0 commit comments

Comments
 (0)