linePrintList method

void linePrintList(
  1. List<String> _l,
  2. String lName,
  3. int _w
)

Printing list in many, _w, rows. With line-feed after 2 rows.

Implementation

void linePrintList(List<String> _l, String lName, int _w) {
  int _length = _l.length;
  int _rowCount = 0;
  StringBuffer buf = new StringBuffer();
  StringBuffer rowBuf = new StringBuffer();
  int y = 0;
  for (var x = 0; x < _l.length; x++) {
    y++;
    rowBuf.write(_l[x]);
    rowBuf.write(' ');
    if (y >= _w) {
      //   || (x == _length)
      buf.write(rowBuf);
      buf.writeln(''); //  line-feed, suppose.
      rowBuf.clear(); //  empty buffer
      y = 0;
    }
  }
  print('------------ linePrintList  Name: $lName -----------------');
  print(buf);
  print('int _length: $_length and _rowCount: $_rowCount :not used here ---');
  print('------------ linePrintList done  -------------------------\n');
}