Skip to content
pubscout

pool

1.5.3, released 3 months ago by tools.dart.dev

Manage a finite pool of resources to control concurrent operations.

WASM-readyRock solid
$ flutter pub add pool
Source repository

What it does

The pool package exposes a Pool class that makes it easy to manage a limited pool of resources. It controls concurrent file system or network requests through withResource or fine-grained PoolResource management.

AI-written summary of version 1.5.3, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to limit concurrent file system or network requests.
  • You want to process an iterable asynchronously with a maximum concurrency limit.

Skip it when

  • You are managing state or UI components.
  • You do not need to limit concurrency.

Strengths

  • Easy to use with withResource callbacks.
  • Supports fine-grained control via PoolResource objects.
  • Includes deadlock timeout handling.

Weaknesses

  • Requires manual tracking to ensure physical resources correspond correctly to pool allocations.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
2
final pool = new Pool(10, timeout: new Duration(seconds: 30));

Future<String> readFile(String path) {
  return pool.withResource(() => new File(path).readAsString());
}

Alternatives

Packages that do the same job and could replace pool.

Works with

Packages commonly used together with pool: ones it builds on, ones built on it, and its own family.