writeFile method
Writes content to a file at the specified path.
filePath
- The path where the file should be created.
content
- The content to write to the file.
This method ensures the parent directory exists before writing the file. If the file already exists, it will be overwritten.
Implementation
Future<void> writeFile(String filePath, String content) async {
final file = File(filePath);
await ensureDirectoryExists(path.dirname(filePath));
await file.writeAsString(content);
}