writeBytesAtomicallySync function

void writeBytesAtomicallySync(
  1. String path,
  2. Uint8List contents
)

The same as writeFileAtomicallySync, for bytes rather than text — FileBinaryStorage's write.

Implementation

void writeBytesAtomicallySync(String path, Uint8List contents) {
  final temporary = File('$path.new')..writeAsBytesSync(contents, flush: true);
  temporary.renameSync(path);
}