removeSlashComments function
Implementation
Future<void> removeSlashComments(String filePath) async {
try {
final file = File(filePath);
if (!await file.exists()) {
throw Exception('File does not exist: $filePath');
}
final content = await file.readAsString();
final newContent = content.replaceAll(RegExp(r'\/\/'), '');
await file.writeAsString(newContent);
} catch (e) {
throw Exception('Failed to remove comments: $e');
}
}