O'Reilly logo

Dart: Scalable Application Development by Ivo Balbaert, Sergey Akopkokhyants, Davy Mitchell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Reading and processing a file line by line

Files containing data in the comma separated values (csv) format are structured so that one line contains data about one object, so we need a way to read and process the file line by line. As an example, we use the data file winequality-red.csv, that contains 1,599 sample measurements, 12 data columns, such as pH and alcohol, per sample, separated by a semicolon (;), of which you can see the top 20 in the following screenshot:

Reading and processing a file line by line

How to do it...

Examine the code of the command-line project processing_lines using the following methods:

  1. Using the readAsLines method as shown in the following code:
    import 'dart:io'; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required