Buffer.withLines constructor
Creates a buffer from a list of strings, one per row.
Implementation
factory Buffer.withLines(List<String> lines) {
if (lines.isEmpty) return Buffer.empty(Rect.zero);
final height = lines.length;
final width = lines.map((l) => l.length).reduce((a, b) => a > b ? a : b);
final buffer = Buffer.empty(Rect(0, 0, width, height));
for (var y = 0; y < height; y++) {
buffer.setString(0, y, lines[y], Style.empty);
}
return buffer;
}