cancel method

Future<bool> cancel()

Cancels the task.

Returns: A Future that resolves to true if canceled successfully.

Implementation

Future<bool> cancel() async {
  await _initFuture;
  if (_helper.isMultipart == null) {
    return false;
  }
  if (this._snapshot.state == TaskState.success) {
    return false;
  }
  await this._helper.abortTask(createClient(storage.app), storage._config);

  await __changeState(TaskState.canceled);
  return true;
}