parseCsv static method
CSV parser that handles quoted fields, escaped commas, etc. Returns a List of rows where each row is a List of String values.
Implementation
static List<List<String>> parseCsv(String csvString) {
final converter = CsvToListConverter(
eol: "\n",
textDelimiter: '"',
fieldDelimiter: ',',
shouldParseNumbers: false, // Keep everything as String.
);
final rows = converter.convert(csvString);
return rows
.map((row) => row.map((cell) => cell?.toString() ?? '').toList())
.toList();
}