writeFileAtomicallySync function
The same, without waiting. For a caller already on a synchronous path.
Implementation
void writeFileAtomicallySync(String path, String contents) {
final temporary = File('$path.new')..writeAsStringSync(contents, flush: true);
temporary.renameSync(path);
}