writeString static method
Writes content as text to target atomically.
Implementation
static Future<void> writeString(File target, String content) async {
final tmp = File('${target.path}.partial');
try {
await tmp.writeAsString(content, flush: true);
tmp.renameSync(target.path);
} finally {
if (tmp.existsSync()) tmp.deleteSync();
}
}