writeToFile method
Writes the stream to the file at path atomically.
The bytes go to a new temporary file in the same directory, which is
renamed over path once the stream has ended without an error. On any
failure or cancellation the temporary file is deleted and path is left
untouched. The directory of path must exist and is not created.
Throws an UnsupportedError on the web.
Implementation
Future<void> writeToFile(String path) => writeStreamAtomically(this, path);