 to a file</h2>
<p>To write a string to a file, use the <a href="dart-io/File/writeAsString.html">writeAsString</a> method:</p>
<pre class="language-dart"><code>import 'dart:io';

void main() {
  final filename = 'file.txt';
  new File(filename).writeAsString('some content')
    .then((File file) {
      // Do something with the file.
    });
}
</code></pre>
<p>You can also write to a file using a <a href="dart-async/Stream-class.html">Stream</a>. Open the file with
<a href="dart-io/File/openWrite.html">ope