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'; ...

Get Dart: Scalable Application Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.