# Control Downloads

There are 3 methods available to control a download, and 1 method to check the download's current state.

{% embed url="<https://pub.dev/documentation/flutter_map_tile_caching/latest/flutter_map_tile_caching/StoreDownload-class.html>" %}

{% hint style="info" %}
It may take some time to perform these operations if the download has a low TPS, as each thread checks the current state/awaits a signal between each of their tiles.

`pause` & `cancel` are asynchronous for this reason, and will complete when all threads are paused or cancelled. `resume` returns immediately.
{% endhint %}

## Pause/Resume

If your user needs to temporarily pause the download, with the ability to resume it at some point later (within the same app session), use `pause` and `resume`.

`pause` allows all threads to finish the tile they're currently downloading, then forces them to wait for a signal sent by `resume` before they can download their next tile. It does not write any buffered tiles to the store.

Use `isPaused` to check whether the download is currently paused.

## Cancel

If your user needs to stop the download entirely, use `cancel`.

`cancel` allows all threads to finish the tile they're currently downloading, then forces them to cleanup and 'kill' themselves. Any buffered tiles are written to the store before the future returned by `cancel` is completed.

It is safe to use `cancel` after `pause` without `resume`ing first.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://fmtc.jaffaketchup.dev/v9/bulk-downloading/control.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
