async
2.13.1, released 8 months ago by dart.dev
Utility classes and helpers that extend Dart's async library.
What it does
Provides wrappers, transformers, and helpers for Futures, Streams, and async operations such as caching, memoizing, cancelable operations, and stream grouping. Includes convenience classes like RestartableTimer and Result.
AI-written summary of version 2.13.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need advanced stream manipulation or cancellation support
- You want to cache or memoize expensive async results
Skip it when
- You only need simple async without extra helpers
- You require a full state‑management solution
Strengths
- Rich set of async utilities
- Well‑maintained by Dart team
- Works on all Dart platforms
Weaknesses
- Adds extra abstraction layer
- May be overkill for tiny projects
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 2
import 'package:async/async.dart';
Future<void> main() async {
final memoizer = AsyncMemoizer();
await memoizer.runOnce(() async => await fetchData());
}
Future<String> fetchData() async => 'data';Alternatives
Packages that do the same job and could replace async.
- gtk
GTK utilities for Flutter Linux applications, providing settings and application lifecycle helpers.
76Compare - ffi
Utilities for working with Foreign Function Interface (FFI) code in Dart.
84Compare - black_hole_flutter
Flutter utility functions, extension methods, and custom widgets.
83Compare - at_utils
Utility library for Atsign Protocol projects with atSign helpers and logging.
82Compare
Works with
Packages commonly used together with async: ones it builds on, ones built on it, and its own family.
- built_valueSame familyImmutable value types with builders, enum classes and JSON serialization for Dart.
- platformSame familyCross‑platform abstraction for querying runtime platform info in Dart.
- hooksSame familyDart API for the JSON-based protocol for package build and link hooks.
- code_assetsSame familyProvides the hook protocol specification for bundling native code with Dart packages.
- intlSame familyA Dart library for internationalization and localization, providing message translation, plural/gender handling, and date/number formatting.
- typed_dataSame familyUtility functions and classes for easier work with dart:typed_data lists.
- http_parserSame familyA platform-independent package for parsing and serializing HTTP formats.
- fake_asyncSame familyFake asynchronous events like timers and microtasks for deterministic testing.