pause method

Future<bool> pause()

Pause file downloading, file will be stored on defined location downloading may be continued from the paused point if file exists

Implementation

Future<bool> pause() async {
  if (_doneOrCancelled || !_downloading) return false;
  _addEvent(TaskEvent(
      state: TaskState.paused,
      bytesReceived: _bytesReceived,
      totalBytes: _totalBytes));
  await _subscription?.cancel();
  _subscription = null;
  return true;
}