in lib/src/strings.dart [152:187]
String yamlEncodeBlockScalar(
YamlNode value, int indentation, String lineEnding) {
if (value is YamlScalar) {
assertValidScalar(value.value);
if (value.value is String) {
if (_hasUnprintableCharacters(value.value)) {
return _yamlEncodeDoubleQuoted(value.value);
}
if (value.style == ScalarStyle.SINGLE_QUOTED) {
return _tryYamlEncodeSingleQuoted(value.value);
}
// Strings with only white spaces will cause a misparsing
if (value.value.trim().length == value.value.length &&
value.value.length != 0) {
if (value.style == ScalarStyle.FOLDED) {
return _tryYamlEncodeFolded(value.value, indentation, lineEnding);
}
if (value.style == ScalarStyle.LITERAL) {
return _tryYamlEncodeLiteral(value.value, indentation, lineEnding);
}
}
}
return _tryYamlEncodePlain(value.value);
}
assertValidScalar(value);
/// The remainder of the possibilities are similar to how [getFlowScalar]
/// treats [value].
return _yamlEncodeFlowScalar(value);
}