update lints, require Dart 3.0 (dart-lang/yaml#156)
* switch expressions
* dry up logic
diff --git a/pkgs/yaml/.github/workflows/test-package.yml b/pkgs/yaml/.github/workflows/test-package.yml
index 0278631..4cb7d3a 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: [2.19.0, dev]
+ sdk: [3.0.0, dev]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d
diff --git a/pkgs/yaml/CHANGELOG.md b/pkgs/yaml/CHANGELOG.md
index 69a6c9f..c246967 100644
--- a/pkgs/yaml/CHANGELOG.md
+++ b/pkgs/yaml/CHANGELOG.md
@@ -1,5 +1,7 @@
## 3.1.3-wip
+* Require Dart 3.0
+
## 3.1.2
* Require Dart 2.19
diff --git a/pkgs/yaml/analysis_options.yaml b/pkgs/yaml/analysis_options.yaml
index 6c0172b..369e386 100644
--- a/pkgs/yaml/analysis_options.yaml
+++ b/pkgs/yaml/analysis_options.yaml
@@ -16,7 +16,4 @@
- package_api_docs
- prefer_const_declarations
- prefer_expression_function_bodies
- - prefer_relative_imports
- - test_types_in_equals
- use_string_buffers
- - use_super_parameters
diff --git a/pkgs/yaml/lib/src/equality.dart b/pkgs/yaml/lib/src/equality.dart
index 5492c49..c833dc6 100644
--- a/pkgs/yaml/lib/src/equality.dart
+++ b/pkgs/yaml/lib/src/equality.dart
@@ -24,8 +24,8 @@
/// A class that provides access to the list of parent objects used for loop
/// detection.
class _DeepEquals {
- final _parents1 = [];
- final _parents2 = [];
+ final _parents1 = <Object?>[];
+ final _parents2 = <Object?>[];
/// Returns whether [obj1] and [obj2] are structurally equivalent.
bool equals(Object? obj1, Object? obj2) {
@@ -101,7 +101,7 @@
/// self-referential structures, and returns the same hash code for
/// [YamlScalar]s and their values.
int deepHashCode(Object? obj) {
- var parents = [];
+ var parents = <Object?>[];
int deepHashCodeInner(Object? value) {
if (parents.any((parent) => identical(parent, value))) return -1;
@@ -109,11 +109,11 @@
parents.add(value);
try {
if (value is Map) {
- var equality = const UnorderedIterableEquality();
+ var equality = const UnorderedIterableEquality<Object?>();
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));
+ return const IterableEquality<Object?>().hash(value.map(deepHashCode));
} else if (value is YamlScalar) {
return (value.value as Object?).hashCode;
} else {
diff --git a/pkgs/yaml/lib/src/error_listener.dart b/pkgs/yaml/lib/src/error_listener.dart
index a0a0d95..0498d68 100644
--- a/pkgs/yaml/lib/src/error_listener.dart
+++ b/pkgs/yaml/lib/src/error_listener.dart
@@ -7,7 +7,7 @@
import 'yaml_exception.dart';
-/// A listener that is notified of [YamlError]s during scanning/parsing.
+/// A listener that is notified of [YamlException]s during scanning/parsing.
abstract class ErrorListener {
/// This method is invoked when an [error] has been found in the YAML.
void onError(YamlException error);
diff --git a/pkgs/yaml/lib/src/event.dart b/pkgs/yaml/lib/src/event.dart
index 0cf19cd..1476311 100644
--- a/pkgs/yaml/lib/src/event.dart
+++ b/pkgs/yaml/lib/src/event.dart
@@ -7,6 +7,7 @@
import 'package:source_span/source_span.dart';
+import 'parser.dart';
import 'style.dart';
import 'yaml_document.dart';
diff --git a/pkgs/yaml/lib/src/loader.dart b/pkgs/yaml/lib/src/loader.dart
index f7cd6c9..7cdf45a 100644
--- a/pkgs/yaml/lib/src/loader.dart
+++ b/pkgs/yaml/lib/src/loader.dart
@@ -80,20 +80,14 @@
}
/// Composes a node.
- YamlNode _loadNode(Event firstEvent) {
- switch (firstEvent.type) {
- case EventType.alias:
- return _loadAlias(firstEvent as AliasEvent);
- case EventType.scalar:
- return _loadScalar(firstEvent as ScalarEvent);
- case EventType.sequenceStart:
- return _loadSequence(firstEvent as SequenceStartEvent);
- case EventType.mappingStart:
- return _loadMapping(firstEvent as MappingStartEvent);
- default:
- throw StateError('Unreachable');
- }
- }
+ YamlNode _loadNode(Event firstEvent) => switch (firstEvent.type) {
+ EventType.alias => _loadAlias(firstEvent as AliasEvent),
+ EventType.scalar => _loadScalar(firstEvent as ScalarEvent),
+ EventType.sequenceStart =>
+ _loadSequence(firstEvent as SequenceStartEvent),
+ EventType.mappingStart => _loadMapping(firstEvent as MappingStartEvent),
+ _ => throw StateError('Unreachable')
+ };
/// Registers an anchor.
void _registerAnchor(String? anchor, YamlNode node) {
@@ -220,61 +214,37 @@
// Dispatch on the first character.
var firstChar = scalar.value.codeUnitAt(0);
- switch (firstChar) {
- case $dot:
- case $plus:
- case $minus:
- return _parseNumber(scalar);
- case $n:
- case $N:
- return length == 4 ? _parseNull(scalar) : null;
- case $t:
- case $T:
- return length == 4 ? _parseBool(scalar) : null;
- case $f:
- case $F:
- return length == 5 ? _parseBool(scalar) : null;
- case $tilde:
- return length == 1 ? YamlScalar.internal(null, scalar) : null;
- default:
- if (firstChar >= $0 && firstChar <= $9) return _parseNumber(scalar);
- return null;
- }
+ return switch (firstChar) {
+ $dot || $plus || $minus => _parseNumber(scalar),
+ $n || $N => length == 4 ? _parseNull(scalar) : null,
+ $t || $T => length == 4 ? _parseBool(scalar) : null,
+ $f || $F => length == 5 ? _parseBool(scalar) : null,
+ $tilde => length == 1 ? YamlScalar.internal(null, scalar) : null,
+ _ => (firstChar >= $0 && firstChar <= $9) ? _parseNumber(scalar) : null
+ };
}
/// Parse a null scalar.
///
/// Returns a Dart `null` if parsing fails.
- YamlScalar? _parseNull(ScalarEvent scalar) {
- switch (scalar.value) {
- case '':
- case 'null':
- case 'Null':
- case 'NULL':
- case '~':
- return YamlScalar.internal(null, scalar);
- default:
- return null;
- }
- }
+ YamlScalar? _parseNull(ScalarEvent scalar) => switch (scalar.value) {
+ '' ||
+ 'null' ||
+ 'Null' ||
+ 'NULL' ||
+ '~' =>
+ YamlScalar.internal(null, scalar),
+ _ => null
+ };
/// Parse a boolean scalar.
///
/// Returns `null` if parsing fails.
- YamlScalar? _parseBool(ScalarEvent scalar) {
- switch (scalar.value) {
- case 'true':
- case 'True':
- case 'TRUE':
- return YamlScalar.internal(true, scalar);
- case 'false':
- case 'False':
- case 'FALSE':
- return YamlScalar.internal(false, scalar);
- default:
- return null;
- }
- }
+ YamlScalar? _parseBool(ScalarEvent scalar) => switch (scalar.value) {
+ 'true' || 'True' || 'TRUE' => YamlScalar.internal(true, scalar),
+ 'false' || 'False' || 'FALSE' => YamlScalar.internal(false, scalar),
+ _ => null
+ };
/// Parses a numeric scalar.
///
diff --git a/pkgs/yaml/lib/src/null_span.dart b/pkgs/yaml/lib/src/null_span.dart
index badb495..49e1a1c 100644
--- a/pkgs/yaml/lib/src/null_span.dart
+++ b/pkgs/yaml/lib/src/null_span.dart
@@ -7,6 +7,8 @@
import 'package:source_span/source_span.dart';
+import 'yaml_node.dart';
+
/// A [SourceSpan] with no location information.
///
/// This is used with [YamlMap.wrap] and [YamlList.wrap] to provide means of
@@ -20,5 +22,5 @@
@override
final text = '';
- NullSpan(sourceUrl) : start = SourceLocation(0, sourceUrl: sourceUrl);
+ NullSpan(Object? sourceUrl) : start = SourceLocation(0, sourceUrl: sourceUrl);
}
diff --git a/pkgs/yaml/lib/src/scanner.dart b/pkgs/yaml/lib/src/scanner.dart
index e1c584f..4bf0b93 100644
--- a/pkgs/yaml/lib/src/scanner.dart
+++ b/pkgs/yaml/lib/src/scanner.dart
@@ -124,7 +124,7 @@
/// The number of tokens that have been emitted.
///
- /// This doesn't count tokens in [tokens].
+ /// This doesn't count tokens in [_tokens].
var _tokensParsed = 0;
/// Whether the next token in [_tokens] is ready to be returned.
@@ -249,21 +249,12 @@
/// See http://yaml.org/spec/1.2/spec.html#nb-char.
bool get _isNonBreak {
var char = _scanner.peekChar();
- if (char == null) return false;
- switch (char) {
- case LF:
- case CR:
- case BOM:
- return false;
- case TAB:
- case NEL:
- return true;
- default:
- return (char >= 0x00020 && char <= 0x00007E) ||
- (char >= 0x000A0 && char <= 0x00D7FF) ||
- (char >= 0x0E000 && char <= 0x00FFFD) ||
- (char >= 0x10000 && char <= 0x10FFFF);
- }
+ return switch (char) {
+ null => false,
+ LF || CR || BOM => false,
+ TAB || NEL => true,
+ _ => _isStandardCharacter(char),
+ };
}
/// Whether the character at the current position is a printable character
@@ -272,21 +263,12 @@
/// See http://yaml.org/spec/1.2/spec.html#nb-char.
bool get _isNonSpace {
var char = _scanner.peekChar();
- if (char == null) return false;
- switch (char) {
- case LF:
- case CR:
- case BOM:
- case SP:
- return false;
- case NEL:
- return true;
- default:
- return (char >= 0x00020 && char <= 0x00007E) ||
- (char >= 0x000A0 && char <= 0x00D7FF) ||
- (char >= 0x0E000 && char <= 0x00FFFD) ||
- (char >= 0x10000 && char <= 0x10FFFF);
- }
+ return switch (char) {
+ null => false,
+ LF || CR || BOM || SP => false,
+ NEL => true,
+ _ => _isStandardCharacter(char),
+ };
}
/// Returns Whether or not the current character begins a documentation
@@ -830,7 +812,7 @@
}
}
- /// Scans a [TokenType.YAML_DIRECTIVE] or [TokenType.tagDirective] token.
+ /// Scans a [TokenType.versionDirective] or [TokenType.tagDirective] token.
///
/// %YAML 1.2 # a comment \n
/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -1593,32 +1575,28 @@
/// See http://yaml.org/spec/1.2/spec.html#ns-plain-safe(c).
bool _isPlainSafeAt(int offset) {
var char = _scanner.peekChar(offset);
- switch (char) {
- case COMMA:
- case LEFT_SQUARE:
- case RIGHT_SQUARE:
- case LEFT_CURLY:
- case RIGHT_CURLY:
+ return switch (char) {
+ null => false,
+ COMMA ||
+ LEFT_SQUARE ||
+ RIGHT_SQUARE ||
+ LEFT_CURLY ||
+ RIGHT_CURLY =>
// These characters are delimiters in a flow context and thus are only
// safe in a block context.
- return _inBlockContext;
- case SP:
- case TAB:
- case LF:
- case CR:
- case BOM:
- return false;
- case NEL:
- return true;
- default:
- return char != null &&
- ((char >= 0x00020 && char <= 0x00007E) ||
- (char >= 0x000A0 && char <= 0x00D7FF) ||
- (char >= 0x0E000 && char <= 0x00FFFD) ||
- (char >= 0x10000 && char <= 0x10FFFF));
- }
+ _inBlockContext,
+ SP || TAB || LF || CR || BOM => false,
+ NEL => true,
+ _ => _isStandardCharacter(char)
+ };
}
+ bool _isStandardCharacter(int char) =>
+ (char >= 0x00020 && char <= 0x00007E) ||
+ (char >= 0x000A0 && char <= 0x00D7FF) ||
+ (char >= 0x0E000 && char <= 0x00FFFD) ||
+ (char >= 0x10000 && char <= 0x10FFFF);
+
/// Returns the hexidecimal value of [char].
int _asHex(int char) {
if (char <= NUMBER_9) return char - NUMBER_0;
@@ -1656,7 +1634,7 @@
/// The index of the token that begins the simple key.
///
/// This is the index relative to all tokens emitted, rather than relative to
- /// [_tokens].
+ /// [location].
final int tokenNumber;
/// The source location of the beginning of the simple key.
diff --git a/pkgs/yaml/lib/src/style.dart b/pkgs/yaml/lib/src/style.dart
index 4121f09..96c3b94 100644
--- a/pkgs/yaml/lib/src/style.dart
+++ b/pkgs/yaml/lib/src/style.dart
@@ -7,6 +7,8 @@
// ignore_for_file: constant_identifier_names
+import 'yaml_node.dart';
+
/// An enum of source scalar styles.
class ScalarStyle {
/// No source style was specified.
diff --git a/pkgs/yaml/lib/src/token.dart b/pkgs/yaml/lib/src/token.dart
index 282d773..7d5d6bc 100644
--- a/pkgs/yaml/lib/src/token.dart
+++ b/pkgs/yaml/lib/src/token.dart
@@ -7,6 +7,7 @@
import 'package:source_span/source_span.dart';
+import 'scanner.dart';
import 'style.dart';
/// A token emitted by a [Scanner].
diff --git a/pkgs/yaml/lib/src/yaml_node.dart b/pkgs/yaml/lib/src/yaml_node.dart
index c8f1e23..bd17b6c 100644
--- a/pkgs/yaml/lib/src/yaml_node.dart
+++ b/pkgs/yaml/lib/src/yaml_node.dart
@@ -37,14 +37,14 @@
/// The inner value of this node.
///
/// For [YamlScalar]s, this will return the wrapped value. For [YamlMap] and
- /// [YamlList], it will return [this], since they already implement [Map] and
+ /// [YamlList], it will return `this`, since they already implement [Map] and
/// [List], respectively.
dynamic get value;
}
/// A read-only [Map] parsed from YAML.
class YamlMap extends YamlNode with collection.MapMixin, UnmodifiableMapMixin {
- /// A view of [this] where the keys and values are guaranteed to be
+ /// A view of `this` where the keys and values are guaranteed to be
/// [YamlNode]s.
///
/// The key type is `dynamic` to allow values to be accessed using
@@ -70,19 +70,19 @@
/// is passed, it's used as the [SourceSpan.sourceUrl].
///
/// [sourceUrl] may be either a [String], a [Uri], or `null`.
- factory YamlMap({sourceUrl}) => YamlMapWrapper(const {}, sourceUrl);
+ factory YamlMap({Object? sourceUrl}) => YamlMapWrapper(const {}, sourceUrl);
/// Wraps a Dart map so that it can be accessed (recursively) like a
/// [YamlMap].
///
/// Any [SourceSpan]s returned by this map or its children will be dummies
/// without useful location information. However, they will have a reasonable
- /// implementation of [SourceSpan.getLocationMessage]. If [sourceUrl] is
+ /// implementation of [SourceSpan.message]. If [sourceUrl] is
/// passed, it's used as the [SourceSpan.sourceUrl].
///
/// [sourceUrl] may be either a [String], a [Uri], or `null`.
factory YamlMap.wrap(Map dartMap,
- {sourceUrl, CollectionStyle style = CollectionStyle.ANY}) =>
+ {Object? sourceUrl, CollectionStyle style = CollectionStyle.ANY}) =>
YamlMapWrapper(dartMap, sourceUrl, style: style);
/// Users of the library should not use this constructor.
@@ -120,19 +120,19 @@
/// [sourceUrl] is passed, it's used as the [SourceSpan.sourceUrl].
///
/// [sourceUrl] may be either a [String], a [Uri], or `null`.
- factory YamlList({sourceUrl}) => YamlListWrapper(const [], sourceUrl);
+ factory YamlList({Object? sourceUrl}) => YamlListWrapper(const [], sourceUrl);
/// Wraps a Dart list so that it can be accessed (recursively) like a
/// [YamlList].
///
/// Any [SourceSpan]s returned by this list or its children will be dummies
/// without useful location information. However, they will have a reasonable
- /// implementation of [SourceSpan.getLocationMessage]. If [sourceUrl] is
+ /// implementation of [SourceSpan.message]. If [sourceUrl] is
/// passed, it's used as the [SourceSpan.sourceUrl].
///
/// [sourceUrl] may be either a [String], a [Uri], or `null`.
factory YamlList.wrap(List dartList,
- {sourceUrl, CollectionStyle style = CollectionStyle.ANY}) =>
+ {Object? sourceUrl, CollectionStyle style = CollectionStyle.ANY}) =>
YamlListWrapper(dartList, sourceUrl, style: style);
/// Users of the library should not use this constructor.
@@ -164,7 +164,7 @@
/// [sourceUrl] is passed, it's used as the [SourceSpan.sourceUrl].
///
/// [sourceUrl] may be either a [String], a [Uri], or `null`.
- YamlScalar.wrap(this.value, {sourceUrl, this.style = ScalarStyle.ANY})
+ YamlScalar.wrap(this.value, {Object? sourceUrl, this.style = ScalarStyle.ANY})
: super._(NullSpan(sourceUrl)) {
ArgumentError.checkNotNull(style, 'style');
}
diff --git a/pkgs/yaml/lib/src/yaml_node_wrapper.dart b/pkgs/yaml/lib/src/yaml_node_wrapper.dart
index 5dbf486..5250844 100644
--- a/pkgs/yaml/lib/src/yaml_node_wrapper.dart
+++ b/pkgs/yaml/lib/src/yaml_node_wrapper.dart
@@ -35,7 +35,7 @@
@override
Iterable get keys => _dartMap.keys;
- YamlMapWrapper(Map dartMap, sourceUrl,
+ YamlMapWrapper(Map dartMap, Object? sourceUrl,
{CollectionStyle style = CollectionStyle.ANY})
: this._(dartMap, NullSpan(sourceUrl), style: style);
@@ -116,7 +116,7 @@
throw UnsupportedError('Cannot modify an unmodifiable List.');
}
- YamlListWrapper(List dartList, sourceUrl,
+ YamlListWrapper(List dartList, Object? sourceUrl,
{CollectionStyle style = CollectionStyle.ANY})
: this._(dartList, NullSpan(sourceUrl), style: style);
@@ -182,7 +182,7 @@
other is _YamlListNodes && other._dartList == _dartList;
}
-YamlNode _nodeForValue(value, SourceSpan span) {
+YamlNode _nodeForValue(Object? value, SourceSpan span) {
if (value is Map) return YamlMapWrapper._(value, span);
if (value is List) return YamlListWrapper._(value, span);
return YamlScalar.internalWithSpan(value, span);
diff --git a/pkgs/yaml/lib/yaml.dart b/pkgs/yaml/lib/yaml.dart
index 96869d3..26cc9b8 100644
--- a/pkgs/yaml/lib/yaml.dart
+++ b/pkgs/yaml/lib/yaml.dart
@@ -29,9 +29,6 @@
/// These have a few small behavioral differences from the default Map
/// implementation; for details, see the [YamlMap] class.
///
-/// In future versions, maps will instead be [HashMap]s with a custom equality
-/// operation.
-///
/// If [sourceUrl] is passed, it's used as the URL from which the YAML
/// originated for error reporting.
///
@@ -91,9 +88,6 @@
/// These have a few small behavioral differences from the default Map
/// implementation; for details, see the [YamlMap] class.
///
-/// In future versions, maps will instead be [HashMap]s with a custom equality
-/// operation.
-///
/// If [sourceUrl] is passed, it's used as the URL from which the YAML
/// originated for error reporting.
YamlList loadYamlStream(String yaml, {Uri? sourceUrl}) {
diff --git a/pkgs/yaml/pubspec.yaml b/pkgs/yaml/pubspec.yaml
index 1671b26..e6b6f15 100644
--- a/pkgs/yaml/pubspec.yaml
+++ b/pkgs/yaml/pubspec.yaml
@@ -7,7 +7,7 @@
- config-format
environment:
- sdk: '>=2.19.0 <3.0.0'
+ sdk: ^3.0.0
dependencies:
collection: ^1.15.0
@@ -15,6 +15,6 @@
string_scanner: ^1.1.0
dev_dependencies:
- dart_flutter_team_lints: ^1.0.0
+ dart_flutter_team_lints: ^2.0.0
path: ^1.8.0
test: ^1.16.0
diff --git a/pkgs/yaml/test/utils.dart b/pkgs/yaml/test/utils.dart
index 5b85234..372440a 100644
--- a/pkgs/yaml/test/utils.dart
+++ b/pkgs/yaml/test/utils.dart
@@ -10,7 +10,7 @@
import 'package:yaml/yaml.dart';
/// A matcher that validates that a closure or Future throws a [YamlException].
-final Matcher throwsYamlException = throwsA(TypeMatcher<YamlException>());
+final Matcher throwsYamlException = throwsA(isA<YamlException>());
/// Returns a matcher that asserts that the value equals [expected].
///
@@ -20,7 +20,7 @@
/// Constructs a new yaml.YamlMap, optionally from a normal Map.
Map deepEqualsMap([Map? from]) {
- var map = equality.deepEqualsMap();
+ var map = equality.deepEqualsMap<Object?, Object?>();
if (from != null) map.addAll(from);
return map;
}
diff --git a/pkgs/yaml/test/yaml_node_wrapper_test.dart b/pkgs/yaml/test/yaml_node_wrapper_test.dart
index 699066e..637b778 100644
--- a/pkgs/yaml/test/yaml_node_wrapper_test.dart
+++ b/pkgs/yaml/test/yaml_node_wrapper_test.dart
@@ -58,19 +58,19 @@
}));
expect(map.span, isNullSpan(isNull));
- expect(map['list'], TypeMatcher<YamlList>());
- expect(map['list'].nodes[0], TypeMatcher<YamlScalar>());
+ expect(map['list'], isA<YamlList>());
+ expect(map['list'].nodes[0], isA<YamlScalar>());
expect(map['list'].span, isNullSpan(isNull));
- expect(map['map'], TypeMatcher<YamlMap>());
- expect(map['map'].nodes['foo'], TypeMatcher<YamlScalar>());
- expect(map['map']['nested'], TypeMatcher<YamlList>());
+ expect(map['map'], isA<YamlMap>());
+ expect(map['map'].nodes['foo'], isA<YamlScalar>());
+ expect(map['map']['nested'], isA<YamlList>());
expect(map['map'].span, isNullSpan(isNull));
- expect(map.nodes['scalar'], TypeMatcher<YamlScalar>());
+ expect(map.nodes['scalar'], isA<YamlScalar>());
expect(map.nodes['scalar']!.value, 'value');
expect(map.nodes['scalar']!.span, isNullSpan(isNull));
expect(map['scalar'], 'value');
expect(map.keys, unorderedEquals(['list', 'map', 'scalar']));
- expect(map.nodes.keys, everyElement(TypeMatcher<YamlScalar>()));
+ expect(map.nodes.keys, everyElement(isA<YamlScalar>()));
expect(map.nodes[YamlScalar.wrap('list')], equals([1, 2, 3]));
expect(map.style, equals(CollectionStyle.ANY));
expect((map.nodes['list'] as YamlList).style, equals(CollectionStyle.ANY));
@@ -135,14 +135,14 @@
]));
expect(list.span, isNullSpan(isNull));
- expect(list[0], TypeMatcher<YamlList>());
- expect(list[0].nodes[0], TypeMatcher<YamlScalar>());
+ expect(list[0], isA<YamlList>());
+ expect(list[0].nodes[0], isA<YamlScalar>());
expect(list[0].span, isNullSpan(isNull));
- expect(list[1], TypeMatcher<YamlMap>());
- expect(list[1].nodes['foo'], TypeMatcher<YamlScalar>());
- expect(list[1]['nested'], TypeMatcher<YamlList>());
+ expect(list[1], isA<YamlMap>());
+ expect(list[1].nodes['foo'], isA<YamlScalar>());
+ expect(list[1]['nested'], isA<YamlList>());
expect(list[1].span, isNullSpan(isNull));
- expect(list.nodes[2], TypeMatcher<YamlScalar>());
+ expect(list.nodes[2], isA<YamlScalar>());
expect(list.nodes[2].value, 'value');
expect(list.nodes[2].span, isNullSpan(isNull));
expect(list[2], 'value');
@@ -223,7 +223,7 @@
}
Matcher isNullSpan(Object sourceUrl) => predicate((SourceSpan span) {
- expect(span, TypeMatcher<SourceSpan>());
+ expect(span, isA<SourceSpan>());
expect(span.length, equals(0));
expect(span.text, isEmpty);
expect(span.start, equals(span.end));