delete static method

Future<void> delete(
  1. String folderPath,
  2. String fileName
)

Deletes the file with the given fileName from the specified folderPath.

If the file or folder does not exist, this method does nothing.

Implementation

static Future<void> delete(String folderPath, String fileName) async {
  final targetDir = Directory(folderPath);
  if (!await targetDir.exists()) {
    return;
  }
  String filePath = "${targetDir.path}/$fileName";
  final file = File(filePath);

  if (await file.exists()) {
    await file.delete();
  }
}