pool
1.5.3, released 3 months ago by tools.dart.dev
Manage a finite pool of resources to control concurrent operations.
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.
- resource_portable
Read resource data and files in a portable way across VM, Web, and Flutter.
70Compare - properties
A simple library to read, write, and manipulate Java-style properties files in Dart.
50Compare - computer
Easy to use pool of concurrent workers with a compute-like API.
48Compare - system_resources_2
Access CPU and memory usage, container-aware, pure Dart on Linux, FFI on macOS
59Compare
Works with
Packages commonly used together with pool: ones it builds on, ones built on it, and its own family.
- stack_tracepool depends on itProvides parsing, inspection, and readable formatting of Dart stack traces.
- asyncpool depends on itUtility classes and helpers that extend Dart's async library.
- coverageSame familyCollects, manipulates, and formats code coverage data in Dart
- test_apiSame familyThe user facing API for structuring Dart tests and checking expectations.
- shelfSame familyComposable web server middleware for Dart
- source_map_stack_traceSame familyConverts dart2js-compiled JavaScript stack traces into readable native Dart stack traces.
- testBuilt on poolA full featured library for writing and running Dart tests across platforms.
- sseBuilt on poolBidirectional Server Sent Events client and server for Dart.