updates for the next version of package:yaml (dart-lang/yaml_edit#45)
diff --git a/pkgs/yaml_edit/CHANGELOG.md b/pkgs/yaml_edit/CHANGELOG.md
index 797a07f..cf1c47f 100644
--- a/pkgs/yaml_edit/CHANGELOG.md
+++ b/pkgs/yaml_edit/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 2.1.1
+
+- Update to work with an unreleased version of `package:yaml`.
+
## 2.1.0
- **Breaking** `wrapAsYamlNode(value, collectionStyle, scalarStyle)` will apply
`collectionStyle` and `scalarStyle` recursively when wrapping a children of
diff --git a/pkgs/yaml_edit/lib/src/strings.dart b/pkgs/yaml_edit/lib/src/strings.dart
index 62fe280..f156afe 100644
--- a/pkgs/yaml_edit/lib/src/strings.dart
+++ b/pkgs/yaml_edit/lib/src/strings.dart
@@ -139,13 +139,14 @@
assertValidScalar(value.value);
if (value.value is String) {
- if (_hasUnprintableCharacters(value.value) ||
+ final val = value.value as String;
+ if (_hasUnprintableCharacters(val) ||
value.style == ScalarStyle.DOUBLE_QUOTED) {
- return _yamlEncodeDoubleQuoted(value.value);
+ return _yamlEncodeDoubleQuoted(val);
}
if (value.style == ScalarStyle.SINGLE_QUOTED) {
- return _tryYamlEncodeSingleQuoted(value.value);
+ return _tryYamlEncodeSingleQuoted(val);
}
}
@@ -172,23 +173,23 @@
assertValidScalar(value.value);
if (value.value is String) {
- if (_hasUnprintableCharacters(value.value)) {
- return _yamlEncodeDoubleQuoted(value.value);
+ final val = value.value as String;
+ if (_hasUnprintableCharacters(val)) {
+ return _yamlEncodeDoubleQuoted(val);
}
if (value.style == ScalarStyle.SINGLE_QUOTED) {
- return _tryYamlEncodeSingleQuoted(value.value);
+ return _tryYamlEncodeSingleQuoted(val);
}
// Strings with only white spaces will cause a misparsing
- if (value.value.trim().length == value.value.length &&
- value.value.length != 0) {
+ if (val.trim().length == val.length && val.isNotEmpty) {
if (value.style == ScalarStyle.FOLDED) {
- return _tryYamlEncodeFolded(value.value, indentation, lineEnding);
+ return _tryYamlEncodeFolded(val, indentation, lineEnding);
}
if (value.style == ScalarStyle.LITERAL) {
- return _tryYamlEncodeLiteral(value.value, indentation, lineEnding);
+ return _tryYamlEncodeLiteral(val, indentation, lineEnding);
}
}
}
diff --git a/pkgs/yaml_edit/pubspec.yaml b/pkgs/yaml_edit/pubspec.yaml
index d726abe..8ddaafb 100644
--- a/pkgs/yaml_edit/pubspec.yaml
+++ b/pkgs/yaml_edit/pubspec.yaml
@@ -1,5 +1,5 @@
name: yaml_edit
-version: 2.1.0
+version: 2.1.1
description: A library for YAML manipulation with comment and whitespace preservation.
repository: https://github.com/dart-lang/yaml_edit
issue_tracker: https://github.com/dart-lang/yaml_edit/issues