cancel static method

void cancel(
  1. String url
)

Cancel an active download.

Implementation

static void cancel(String url) {
  final state = _downloads[url];
  if (state != null) {
    state.cancelled = true;
    state.request?.abort();
    try {
      if (state.controller != null && !state.controller!.isClosed) {
        state.controller!.close();
      }
    } catch (_) {}
    _downloads.remove(url);
  }
}