postfixLast function
Append postfix to the last line of lines.
If lines is empty, the result will be as well. The postfix will not be
returned for an empty input.
Implementation
Iterable<String> postfixLast(String postfix, Iterable<String> lines) sync* {
var iterator = lines.iterator;
var hasNext = iterator.moveNext();
while (hasNext) {
final line = iterator.current;
hasNext = iterator.moveNext();
yield hasNext ? line : '$line$postfix';
}
}