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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.