concurrency property

int get concurrency

Current concurrency limit

Can be changed at runtime to increase or decrease the limit.

Example:

final limit = fLimit(2);
limit.concurrency = 5; // Increase to 5

Implementation

int get concurrency => _concurrency;
set concurrency (int newConcurrency)

Set new concurrency limit

Can be changed at runtime. Increasing the limit will immediately start processing queued tasks if slots are available.

Throws ArgumentError if value is less than 1 or infinite.

Example:

final limit = fLimit(1);
limit.concurrency = 10; // Scale up

Implementation

set concurrency(int newConcurrency) {
  _validateConcurrency(newConcurrency);
  _concurrency = newConcurrency;

  // Use scheduleMicrotask to ensure this runs in the next microtask
  scheduleMicrotask(() {
    _tryResumeNext();
  });
}