ain() {
  final file = new File('file.txt');
  Stream&lt;List&lt;int&gt;&gt; inputStream = file.openRead();

  inputStream
    .transform(utf8.decoder)       // Decode bytes to UTF-8.
    .transform(new LineSplitter()) // Convert stream to individual lines.
    .listen((String line) {        // Process results.
        print('$line: ${line.length} bytes');
      },
      onDone: () { print('File is now closed.'); },
      onError: (e) { print(e.toString()); });
}
</code></pre>
<h2 id="write-to-a-file">Write