deleteIfExists method

Future<FileSystemEntity?> deleteIfExists({
  1. bool recursive = false,
})

Deletes the directory and its contents if it exists.

Implementation

Future<FileSystemEntity?> deleteIfExists({bool recursive = false}) async {
  if (await exists()) {
    return await delete(recursive: recursive);
  }
  return null;
}