Code Monkey home page Code Monkey logo

Comments (7)

close2 avatar close2 commented on July 28, 2024 13

Are you trying to parse the same csv file?

My first guess would be that the End Of Line character is different.

Try the FirstOccurenceSettingsDetector:

var d = new FirstOccurrenceSettingsDetector(eols: ['\r\n', '\n']);

String codetxt = await rootBundle.loadString('assets/file.csv');
List<List<dynamic>> codeList = CsvToListConverter(csvSettingsDetector: d).convert(codetxt);
print('codelist size ' + codeList.length.toString());

from csv.

bettdouglas avatar bettdouglas commented on July 28, 2024 3

This problem started after upgrading flutter. One has to specify this way explicitly.
On my side, it worked well before the update, but after going to flutter 1.9.1 from flutter 1.7.8, i had to explicitly specify var d = new FirstOccurrenceSettingsDetector(eols: ['\r\n', '\n']);

Are you trying to parse the same csv file?

My first guess would be that the End Of Line character is different.

Try the FirstOccurenceSettingsDetector:

var d = new FirstOccurrenceSettingsDetector(eols: ['\r\n', '\n']);

String codetxt = await rootBundle.loadString('assets/file.csv');
List<List<dynamic>> codeList = CsvToListConverter(csvSettingsDetector: d).convert(codetxt);
print('codelist size ' + codeList.length.toString());

from csv.

joknjokn avatar joknjokn commented on July 28, 2024 2

I had to import a specific file from the csv-library in order to access FirstOccurenceSettingsDetector:

import 'package:csv/csv_settings_autodetection.dart' as csvAuto;

var d = new csvAuto.FirstOccurrenceSettingsDetector(eols: ['\r\n', '\n']);

from csv.

tantzygames avatar tantzygames commented on July 28, 2024

Yes, it's the same file, but your suggestion worked. Thanks!

I'm compiling Android on Windows and iOS on Mac. The file has \r\n line endings, but maybe mac is ignoring the \r which was causing the problem?

PS Thanks so much for this package. CSV is 600k, equivalent json is over 2Mb and slow to load on iOS.

from csv.

Automatik avatar Automatik commented on July 28, 2024

Are you trying to parse the same csv file?

My first guess would be that the End Of Line character is different.

Try the FirstOccurenceSettingsDetector:

var d = new FirstOccurrenceSettingsDetector(eols: ['\r\n', '\n']);

String codetxt = await rootBundle.loadString('assets/file.csv');
List<List<dynamic>> codeList = CsvToListConverter(csvSettingsDetector: d).convert(codetxt);
print('codelist size ' + codeList.length.toString());

Thank you, it worked for me too. Flutter version 1.20.1 and csv: ^4.0.3

from csv.

nathantaal avatar nathantaal commented on July 28, 2024

I ran the code on my Windows PC giving my Android virtual and real device a working file, but when deployed via Play Store it didn't work. This finally made me realize it's just a compiletime issue. My app is built on a Linux device.
This issue should be closed, as it is not really an issue :)

from csv.

close2 avatar close2 commented on July 28, 2024

Thanks for the feedback!

from csv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.