tomYamlListItem function
One - item of a block sequence whose dashes sit at column indent.
A map item puts its first key on the dash line and the rest under it —
- id: x / title: y — which is how every todo in the workspace is
written.
Implementation
String tomYamlListItem(Object? item, int indent, String nl) {
final pad = ' ' * indent;
if (item is Map && item.isNotEmpty) {
final out = StringBuffer();
var first = true;
for (final e in item.entries) {
final entry = tomYamlEntry('${e.key}', e.value, indent + 2, nl);
out.write(first ? '$pad- ${entry.substring(indent + 2)}' : entry);
first = false;
}
return out.toString();
}
final out = StringBuffer('$pad-');
_value(out, item, indent, nl);
return out.toString();
}