kvlmSerialize function
Implementation
Uint8List kvlmSerialize(Map<String, dynamic> kvlm) {
var bytesBuilder = BytesBuilder(copy: false);
kvlm.forEach((key, val) {
if (key == '_') {
return;
}
if (val is! List) {
val = [val];
}
val.forEach((v) {
bytesBuilder
..add(utf8.encode(key))
..addByte(asciiHelper.space)
..add(utf8.encode(v.replaceAll('\n', '\n ')))
..addByte(asciiHelper.newLine);
});
});
bytesBuilder
..addByte(asciiHelper.newLine)
..add(utf8.encode(kvlm['_']));
return bytesBuilder.toBytes();
}