formatValueWith method Null safety

String formatValueWith(
  1. String fmt(
    1. Value
    )
)

Implementation

String formatValueWith(String Function(Value) fmt) {
  final sb = StringBuffer();
  for (int r = 0; r < rows; r++) {
    for (int c = 0; c < columns; c++) {
      if (c == 0) {
        sb.write('    ');
      }
      sb.write(fmt(get(r, c)).trim().padLeft(11));
      if (c != columns - 1) {
        sb.write(',   ');
      }
    }
    sb.writeln();
  }
  return sb.toString();
}