removeFile function

Future<void> removeFile(
  1. String filePath
)

Implementation

Future<void> removeFile(String filePath) async {
  try {
    final file = File(filePath);

    // Check if the file exists
    if (await file.exists()) {
      // Delete the file
      await file.delete();
      print('File $filePath deleted successfully.');
    } else {
      print('File $filePath does not exist.');
    }
  } catch (e) {
    print('Error deleting file: $e');
  }
}