parseBytes static method
Parse bytes into rows based on type
bytes - The raw bytes to parse
type - The file type
sheetName - For Excel files, the specific sheet name to parse
sheetIndex - For Excel files, the sheet index (default: 0)
Returns a list of rows, where each row is a list of cell values
Implementation
static List<List<dynamic>> parseBytes(
Uint8List bytes,
SheetType type, {
String? sheetName,
int? sheetIndex,
}) {
if (type.isExcel) {
return ExcelParser.parse(
bytes,
type,
sheetName: sheetName,
sheetIndex: sheetIndex,
);
} else if (type.isTextBased) {
return CsvParser.parse(bytes, type);
} else {
throw Exception('Unsupported sheet type: $type');
}
}