cancel method

Future<void> cancel()

Cancels the ongoing foreground download and recovery session (within the current object)

Do not use to cancel background downloads, return true from the background download callback to cancel a background download. Background download cancellations require a few more 'shut-down' steps that can create unexpected issues and memory leaks if not carried out.

Note that another instance of this object must be retrieved before another download is attempted, as this one is destroyed.

Implementation

Future<void> cancel() async {
  _cancelRequestSignal?.complete();
  await _cancelCompleteSignal?.future;

  _internalCancel();
}