> ## Documentation Index
> Fetch the complete documentation index at: https://starrycodes.mintlify.app/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).

<Steps titleSize="h3">
  <Step title="🏎️ Throughput Priority (Unordered)">
    <ResponseField name="runWithLimit(int limit)" type="Future<List<T>>" post={["async"]}>
      <Card>
        <ParamField body="limit" type="int" required>
          The maximum number of `Futures` to run simultaneously.
        </ParamField>
      </Card>

      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.
      </Note>
    </ResponseField>
  </Step>

  <Step title="✍️ Order Preservation">
    <ResponseField name="runWithLimitOrdered(int limit)" type="Future<List<T>>" post={["async"]}>
      <Card>
        <ParamField body="limit" type="int" required>
          The maximum number of `Futures` to run simultaneously.
        </ParamField>
      </Card>

      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.
      </Note>
    </ResponseField>
  </Step>
</Steps>
