Enclst.byStr constructor
- String enclstStr
Constructor by enclst String
Implementation
Enclst.byStr(String enclstStr) {
final re = RegExp(r'\r\n|\n');
List<String> lines = enclstStr.split(re);
title = lines[0];
// Delete the first line, which is title.
lines.removeAt(0);
// find a blank line
while (lines.isNotEmpty) {
if (lines[0] == "") {
// remove blank line
lines.removeAt(0);
break;
} else {
// append to value
value.readStr(lines[0]);
lines.removeAt(0);
}
}
// make items
while (lines.isNotEmpty) {
var line = lines[0];
if (line != "") {
items.add(Item.byStr(lines[0]));
}
lines.removeAt(0);
}
}