YAML: Serialize nodes properly

This fixes the error where a YamlList is not of type string.
This commit is contained in:
Vishesh Handa
2019-10-19 12:53:28 +01:00
parent e8d8c58bff
commit f694536469
2 changed files with 16 additions and 1 deletions

View File

@ -86,7 +86,8 @@ class MarkdownYAMLSerializer implements NoteSerializer {
var str = "";
map.forEach((key, value) {
str += key + ": " + value + "\n";
String val = value.toString();
str += key + ": " + val + "\n";
});
return str;
}

View File

@ -57,6 +57,20 @@ created: 2017-02-15T22:41:19+01:00
foo: bar
---
Alright.""";
var serializer = MarkdownYAMLSerializer();
var note = serializer.decode(str);
var actualStr = serializer.encode(note);
expect(actualStr, str);
});
test('Markdown Serializer YAML Lists', () {
var str = """---
foo: [bar, gar]
---
Alright.""";
var serializer = MarkdownYAMLSerializer();