deleteFilesSync static method
Deletes a file from the specified path.
Parameters:
filePath: The path to the file. Throws:- Exception with message
⚠️ Failed to delete fileon failure.
Implementation
static void deleteFilesSync({required String filePath}) {
try {
print('🗑️ Deleting file $filePath...');
final file = File(filePath);
if (file.existsSync()) {
file.deleteSync();
print('✅ File deleted successfully: $filePath');
}
} catch (_) {
throw Exception('⚠️ Failed to delete: $filePath');
}
}