detectCsvDialect function
Heuristic: count tabs vs commas in first line; if tabs win, delimiter is tab.
Implementation
CsvDialectUtils detectCsvDialect(String sample) {
final String first = sample.split('\n').first;
final int commas = ','.allMatches(first).length;
final int tabs = '\t'.allMatches(first).length;
final String delimiter = tabs >= commas ? '\t' : ',';
return CsvDialectUtils(delimiter: delimiter, hasHeader: true);
}