writeTo method

Future<File> writeTo(
  1. String path, {
  2. Encoding encoding = utf8,
})
override

Writes the contents of the file to file at path

Implementation

Future<File> writeTo(String path, {Encoding encoding = utf8}) async {
  final file = File(path);
  IOSink sink = file.openWrite(encoding: encoding);
  await for (String item in value) {
    sink.write(item);
  }
  await sink.flush();
  await sink.close();
  return file;
}