delete method

Future<void> delete()

Deletes the file on the remote side specified by storageQuery.

You can wait in deleting while it is being deleted.

storageQueryで指定されたリモート側のファイルを削除します。

削除中はdeletingで待つことができます。

Implementation

Future<void> delete() async {
  if (_deleteCompleter != null) {
    await deleting;
    return;
  }
  _deleteCompleter = Completer();
  try {
    await storageQuery.adapter.delete(
      storageQuery.relativeRemotePath.trimQuery().trimStringRight("/"),
    );
    _value = null;
    notifyListeners();
    _deleteCompleter?.complete();
    _deleteCompleter = null;
  } catch (e) {
    _deleteCompleter?.completeError(e);
    _deleteCompleter = null;
    rethrow;
  } finally {
    _deleteCompleter?.complete();
    _deleteCompleter = null;
  }
}