Skip to content

svToListConverter().convert doesn`t work on IOS (works on android) #69

@echogit

Description

@echogit

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.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions