saveTextFile static method
Saves a text file with the given fileName (without extension) and contents
to the specified folderPath. The file will have a .txt extension.
If the folder does not exist, it will be created recursively.
Implementation
static Future<void> saveTextFile(String folderPath, String fileName, String contents) async {
final targetDir = Directory(folderPath);
if (!await targetDir.exists()) {
await targetDir.create(recursive: true);
}
String filePath = "${targetDir.path}/$fileName.txt";
final file = File(filePath);
await file.writeAsString(contents);
}