toFile method
Write the content to the input file.
Implementation
void toFile(String path) {
final result = File(path);
if (!result.existsSync()) result.createSync();
// It may throw error since _layout can be null if file is not used.
result.openWrite().writeAll(this._layout!.layoutAsBytes);
}