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