Skip to content
pubscout

async_extension

1.2.24, released 2 weeks ago by an unverified publisher

Dart async extensions for Future, FutureOr, and performance improvements.

WASM-ready
$ flutter pub add async_extension
Source repository

What it does

Provides extensions and utility functions for Future and FutureOr to optimize synchronous and asynchronous code paths, reduce GC overhead, and add arithmetic operators and try-catch-finally chains for async blocks.

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

Use it when

  • You want to interoperate between sync and async code without unnecessary Future allocations
  • You need arithmetic operators directly on Future and FutureOr instances
  • You want to handle execution chains using utility functions like asyncTry

Skip it when

  • You prefer sticking strictly to standard library async/await primitives without third-party extension methods

Strengths

  • Improves performance and reduces GC overhead for mixed sync/async computations
  • Comprehensive helper methods for FutureOr manipulation and error handling

Weaknesses

  • Relies on custom extension paradigms instead of native language primitives

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0
import 'package:async_extension/async_extension.dart';

void doComputation() {
  FutureOr<int> n = computeSomething();
  var n10 = n.resolveMapped((n) => n * 10);
  n10.onResolve((n) => print('n10: $n'));
}

Alternatives

Packages that do the same job and could replace async_extension.

  • async

    Provides official Dart asynchronous utilities and collection extensions from the core team.

Works with

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