> ## Documentation Index
> Fetch the complete documentation index at: https://starrycodes.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Iterable<Future> - Concurrent Execution

> Execute multiple Futures simultaneously with a concurrency limit. Choose between prioritizing speed (unordered results) or index preservation (ordered results).

### 1. 🏎️ Throughput Priority (Unordered)

**runWithLimit(int limit)** `Future\<List\<T\>\>`

> [card]
>
> **limit** `int` *required*
>
> The maximum number of `Futures` to run simultaneously.

Executes multiple Futures concurrently with a maximum limit. When one finishes, the next is immediately launched.

```dart lines wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
// Runs 2 at a time. If fetch2 finishes before fetch1,
// results will be [result2, result1, ...].
final results = await futures.runWithLimit(2);
```

> [!NOTE]
>
> The results are ordered by completion time and are not guaranteed to match the input iterable's order. Prioritize this for maximum speed.

### 2. ✍️ Order Preservation

**runWithLimitOrdered(int limit)** `Future\<List\<T\>\>`

> [card]
>
> **limit** `int` *required*
>
> The maximum number of `Futures` to run simultaneously.

Executes multiple Futures concurrently while guaranteeing the final list order matches the original input iterable's index.

```dart lines wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
// Final result order is always [result1, result2, result3].
final orderedResults = await futures.runWithLimitOrdered(2);
```

> [!NOTE]
>
> This requires slightly more internal complexity to manage the results, making it marginally slower but ensuring index reliability.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.