writeBytesAtomicallySync function
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);
}