pause method

Future<bool> pause()

Pauses the task.

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

Implementation

Future<bool> pause() async {
  await _initFuture;
  if (_helper.runtimeType == DownloadTaskController) {
    return false;
  }
  if (this._snapshot.state == TaskState.success ||
      this._snapshot.state == TaskState.canceled ||
      this._snapshot.state == TaskState.error ||
      this._snapshot.state == TaskState.paused) {
    return false;
  }
  await __changeState(TaskState.paused);
  return true;
}