svToListConverter().convert doesn`t work on IOS (works on android)
I have a csv on this format with 28 lines:
id,name,image
familia,Família,familia.jpg
minhafamilia,Minha Família,minha-familia.jpg
escola,Escola,escola.jpg
sentimentos,Sentimentos,sentimentos.jpg
On android it creates a list of 28 itens, each one with 3 itens, just as the csv.
On IOs it creates a list of 61 itens, ignoring the first field and adding the 2nd and 3rd field on a sequence. Weird. I`m 3 hours here trying to find out what the problem was.
my code:
final String categoriesCsvContent = await rootBundle.loadString('assets/csvs/$categoriesCsvFileName');
_categoriesCsvData = CsvToListConverter().convert(categoriesCsvContent);
I got the problem just now, it is the eol, so I just changed like this:
categoriesCsvContent = await rootBundle.loadString('assets/csvs/$categoriesCsvFileName');
categoriesCsvContent = categoriesCsvContent.replaceAll('\n','\r\n');
But it would be nice if the code could treat this automatically.
came here to make this post, it works fine on Android but not on IOS
@hedihadi Could you please confirm, that you are using the same file.
If yes, did you try to adjust the EOL as mentioned in the first comment?
@hedihadi What happens if you use:
var d = FirstOccurrenceSettingsDetector(eols: ['\r\n', '\n'],
textDelimiters: ['"', "'"]);
CsvToListConverter(csvSettingsDetector: d);
?