delete method

Future<void> delete(
  1. String path, {
  2. bool mustExist = false,
})

Deletes the FileSystemEntity reference by path.

Implementation

Future<void> delete(String path, {bool mustExist = false}) =>
    entity(path).then((e) async {
      if (e == null) {
        if (mustExist) {
          throw FileSystemException('No such file or directory', path);
        } else {
          return;
        }
      }
      await e.delete(recursive: true);
    });