cancel method

Future<void> cancel()

Implementation

Future<void> cancel() async {
  if (_downloadingStream != null) {
    await _downloadingStream!.cancel();
    if (_finalTask != null) {
      _finalTask!.state = TaskState.canceled;
      _streamController.add(_finalTask!);
    } else {
      _streamController.add(
          ProcessTask(processed: 0, total: 0, state: TaskState.canceled));
    }
  }
}