saveFile method
void
saveFile()
Save the current content, controller.text to the opened file.
Implementation
void saveFile() {
if (openedFile == null) {
throw FlutterError(
"No file found.\nPlease open a file by providing a valid filePath to the CodeForge widget",
);
}
final file = File(openedFile!);
if (!file.existsSync()) {
throw FlutterError(
"No file found.\nPlease open a file by providing a valid filePath to the CodeForge widget",
);
}
file.writeAsStringSync(text);
}