writeToFile static method
- String file,
- CompoundTag tag
Implementation
static Future<void> writeToFile(String file, CompoundTag tag) async {
File handle = File(file);
if (handle.existsSync())
handle.deleteSync(); // Ensure we flush the file to 0 bytes
StringBuilder builder = StringBuilder();
Tag.writeStringifiedNamedTag(tag, builder, 0);
await handle.writeAsString(builder.toString());
}