columnMaxLengths function
Implementation
List<int> columnMaxLengths(List<List<Object>> data) {
if (data.isEmpty) {
return [];
}
final maxColumnLengths = List<int>.filled(data[0].length, 0);
for (final row in data) {
final columnCount = row.length;
for (final column in _range(columnCount)) {
final itemLength = row[column].toString().length;
maxColumnLengths[column] = (itemLength > maxColumnLengths[column])
? itemLength
: maxColumnLengths[column];
}
}
return maxColumnLengths;
}